GNU bug report logs -
#21855
eq?
Previous Next
Reported by: Atticus <atticus0 <at> posteo.org>
Date: Sat, 7 Nov 2015 17:06:02 UTC
Severity: normal
Done: Andy Wingo <wingo <at> pobox.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Sat, Nov 07, 2015 at 01:58:48PM +0100, Atticus wrote:
> So I wanted to try out gnu guix and thus make myself more familiar with
> guile first. While running some tests I encountered a problem/bug with eq?:
>
> $ guile -v
> guile (GNU Guile) 2.1.1
>
> $ guile
> scheme@(guile-user)>
> (define (multirember a lat)
> (cond
> ((null? lat) '())
> ((eq? (car lat) a) (multirember a (cdr lat)))
> (else (cons (car lat) (multirember a (cdr lat))))))
>
> scheme@(guile-user)> (multirember '(a b) '(x y (a b) z (a b)))
> $1 = (x y z)
>
> So why does guile return (x y z)? I expected (x y (a b) z (a b)). I know
> eq? should only be used with symbols (and thus this example is more
> theoretical) but nevertheless the return value is not right, since (eq?
> '(a b) '(a b)) returns #f (Btw same in guile 2.0.11).
Hm. As far as I know (eq? '(a b) '(a b)) is not *guaranteed* to evaluate
to #f. The implementation might be free to re-use things it "knows" to be
constant (I might be wrong, though).
Regards
- -- t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iEYEARECAAYFAlY/IpsACgkQBcgs9XrR2kZMoACZAc49Kzq9JzteJovmzRpH2WLv
M3YAnibf8NUd5bspCqCP2cQiAWNSiREt
=O1dE
-----END PGP SIGNATURE-----
This bug report was last modified 8 years and 333 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.