GNU bug report logs -
#17825
broken set! in iteration
Previous Next
Reported by: Alírio Eyng <alirioeyng <at> gmail.com>
Date: Sat, 21 Jun 2014 02:55:02 UTC
Severity: normal
Tags: notabug
Done: Mark H Weaver <mhw <at> netris.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
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
This bug report was last modified 10 years and 339 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.