From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Linus_Bj=C3=B6rnstam?= Newsgroups: gmane.lisp.guile.user Subject: =?UTF-8?Q?Re:_list-set!_Wrong_type_argument_in_position_1_(expecting_mut?= =?UTF-8?Q?able_pair)?= Date: Wed, 26 Aug 2020 22:43:32 +0200 Message-ID: References: <20200826151232.Horde.54lAstMht7PXoKcNHhj8vJT@www.stihie.net> Mime-Version: 1.0 Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4453"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Cyrus-JMAP/3.3.0-232-g4bdb081-fm-20200825.002-g4bdb081a To: mbcladwell@stihie.net, guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Wed Aug 26 22:44:16 2020 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kB2HI-00015Z-Dm for guile-user@m.gmane-mx.org; Wed, 26 Aug 2020 22:44:16 +0200 Original-Received: from localhost ([::1]:45444 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kB2HH-0003gK-F4 for guile-user@m.gmane-mx.org; Wed, 26 Aug 2020 16:44:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57798) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kB2H5-0003g9-2G for guile-user@gnu.org; Wed, 26 Aug 2020 16:44:03 -0400 Original-Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:38617) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kB2H2-0007YU-UY for guile-user@gnu.org; Wed, 26 Aug 2020 16:44:02 -0400 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 058C01690; Wed, 26 Aug 2020 16:43:55 -0400 (EDT) Original-Received: from imap1 ([10.202.2.51]) by compute4.internal (MEProxy); Wed, 26 Aug 2020 16:43:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.se; h= mime-version:message-id:in-reply-to:references:date:from:to :subject:content-type:content-transfer-encoding; s=fm1; bh=l75TO ADnbfF/HClGOuRVhzlFxNHCIYJAHoMRq1gCxl8=; b=ELnLPZBzYnticMbJEBC0O g71GLVotWL+XpvyPhX75rLi4G793s5UYhhXR78d0zLGhOnBvG0qniF+9v6aedQWc 3UN2O9IwOelejx2HHNf6WlcwjS31LPRHeDlcYFneI1XCfC2BdudQho1ZpzWtK4M3 Vti9XgYtSG2nSIQLbOR/fcHeHkYvz1rD+5mU0yzVwm87ghCUj6y1Q7541NuBOrhg SZ+XviUCvNRorKxUAm+gDjcInZ65ig0SDw3iSCMYRmMrdTNz2jrHKreMxAx3d41I CK1jTFXfIx650ReDRNZOsm//iadHuvHRGkuCMv6wjQKybnEPwy9JaASA/HbgjHGv g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=l75TOADnbfF/HClGOuRVhzlFxNHCIYJAHoMRq1gCx l8=; b=KNzHRoAkeHWxLbn8hfxneOWjXzBVfbN7d1bz5/h5GiOpbNQatxOJoCcPZ h8me37RMfpPtdVwhl0fwdFII1KfeZSoI+eamELeT+FWiHIKhUB+D+9iJfCX5Shpz In6xJUqva3nHFTM126wFQ1KuFog/Hn0PZ3qTw/suoSckDM14Tg3l+AfpQuRlHcUO U6ZgQNmgYRnd0TrakqycGMJLrmH3yPaMbqzwmqrxnlFHbOZAXbl2Xm+GlYkuWs1Y 0QaARVlcD1XKRfeh8dqdfI1K2RDi+TMGlUBNt8j6jaYpBV26WLM/qyVn+0Rc9dEl TzICRA7+iixpEePdx+/zfY77vaO5A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedruddvvddgudeglecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepofgfggfkjghffffhvffutgfgse htqhertderreejnecuhfhrohhmpefnihhnuhhspgeujhpnrhhnshhtrghmuceolhhinhhu shdrihhnthgvrhhnvghtsehfrghsthhmrghilhdrshgvqeenucggtffrrghtthgvrhhnpe ejgfeiteehfedvjedugeeluedthedvfefhgedvkeehfeelgeevtdehleejtefhtdenucff ohhmrghinheprhgrtghkvghtqdhlrghnghdrohhrghenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlihhnuhhsrdhinhhtvghrnhgvthesfhgr shhtmhgrihhlrdhsvg X-ME-Proxy: Original-Received: by mailuser.nyi.internal (Postfix, from userid 501) id BA703C200A5; Wed, 26 Aug 2020 16:43:54 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface In-Reply-To: <20200826151232.Horde.54lAstMht7PXoKcNHhj8vJT@www.stihie.net> Received-SPF: pass client-ip=64.147.123.25; envelope-from=linus.internet@fastmail.se; helo=wout2-smtp.messagingengine.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/26 16:43:56 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:16840 Archived-At: Literals are immutable. (list-set! '(1 2 3) 1 0) -> error. (list-set! (list 1 2 3) 1 0) -> works --=20 Linus Bj=C3=B6rnstam On Wed, 26 Aug 2020, at 22:12, mbcladwell@stihie.net wrote: >=20 > Hi, > One shortcoming I find working with Guile is the limited number of =20= > examples of how to use code. Consider list-set!. The only reference in= =20 > the entire Guile manual is the definition in section 6.6.9.6 List =20 > Modification. If I google I find =20 > https://docs.racket-lang.org/reference/pairs.html which gives me the =20= > example (list-set '(zero one two) 2 "two") =3D=3D> '(zero one "two") w= hich =20 > is what I deduced from the Guile manual. If I try something similar =20= > in Guile: >=20 > scheme@(guile-user)> (list-set! '("zero" "one" "twooooo") 2 "two") > ice-9/boot-9.scm:1669:16: In procedure raise-exception: > In procedure set-car!: Wrong type argument in position 1 (expecting =20= > mutable pair): ("twooooo") >=20 > Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue= . > scheme@(guile-user) [1]> ,bt > 1 (list-set! ("zero" "one" "twooooo") 2 "two") > In ice-9/boot-9.scm: > 1669:16 0 (raise-exception _ #:continuable? _) >=20 > Could someone provide me with an example of how to use list-set! ? > Alternatively what I really need is how to modify a specified element = =20 > in a list. > Thanks > Mortimer >=20 >=20 >