unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: mbcladwell@stihie.net
To: guile-user@gnu.org
Subject: list-set! Wrong type argument in position 1 (expecting mutable pair)
Date: Wed, 26 Aug 2020 15:12:32 -0500	[thread overview]
Message-ID: <20200826151232.Horde.54lAstMht7PXoKcNHhj8vJT@www.stihie.net> (raw)


Hi,
One shortcoming I find working with Guile is the limited number of  
examples of how to use code. Consider list-set!. The only reference in  
the entire Guile manual is the definition in section 6.6.9.6 List  
Modification. If I google I find  
https://docs.racket-lang.org/reference/pairs.html which gives me the  
example (list-set '(zero one two) 2 "two") ==> '(zero one "two") which  
is what I deduced from the Guile manual.  If I try something similar  
in Guile:

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  
mutable pair): ("twooooo")

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? _)

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  
in a list.
Thanks
Mortimer




             reply	other threads:[~2020-08-26 20:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-26 20:12 mbcladwell [this message]
2020-08-26 20:42 ` list-set! Wrong type argument in position 1 (expecting mutable pair) John Cowan
2020-08-26 20:43 ` Linus Björnstam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200826151232.Horde.54lAstMht7PXoKcNHhj8vJT@www.stihie.net \
    --to=mbcladwell@stihie.net \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).