unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: "Alírio Eyng" <alirioeyng@gmail.com>
To: 17825@debbugs.gnu.org
Subject: bug#17825: broken set! in iteration
Date: Sat, 21 Jun 2014 01:25:56 +0000	[thread overview]
Message-ID: <CALkz57FzmdgSPpsJaELqyxcoHAbYK24Jpp_fdwbL_nUgDp8kUg@mail.gmail.com> (raw)

I can't see why the second code doesn't work like the first:

(use-modules (srfi srfi-1))
(define D '(((3 4))))
(let ((r 1))
       (set! D (append D '(())))
       (display D)(newline)
       (set-car! (drop D r) (car (drop D (- r 1)))))
(let ((r 2))
       (set! D (append D '(())))
       (display D)(newline)
       (set-car! (drop D r) (car (drop D (- r 1)))))
output:
(((3 4)) ())
(((3 4)) ((3 4)) ())

(use-modules (srfi srfi-1))
(define D '(((3 4))))
(map (lambda (r)
       (set! D (append D '(())))
       (display D)(newline)
       (set-car! (drop D r) (car (drop D (- r 1)))))
     '(1 2))
output:
(((3 4)) ())
(((3 4)) ((3 4)) ((3 4)))

guile (GNU Guile) 2.0.11
i686-pc-linux-gnu





             reply	other threads:[~2014-06-21  1:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-21  1:25 Alírio Eyng [this message]
2014-06-21 21:19 ` bug#17825: broken set! in iteration Mark H Weaver
2014-06-21 21:29   ` Mark H Weaver

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=CALkz57FzmdgSPpsJaELqyxcoHAbYK24Jpp_fdwbL_nUgDp8kUg@mail.gmail.com \
    --to=alirioeyng@gmail.com \
    --cc=17825@debbugs.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).