From unknown Fri Jun 20 18:21:20 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#21855 <21855@debbugs.gnu.org> To: bug#21855 <21855@debbugs.gnu.org> Subject: Status: eq? Reply-To: bug#21855 <21855@debbugs.gnu.org> Date: Sat, 21 Jun 2025 01:21:20 +0000 retitle 21855 eq? reassign 21855 guile submitter 21855 Atticus severity 21855 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Sat Nov 07 12:05:26 2015 Received: (at submit) by debbugs.gnu.org; 7 Nov 2015 17:05:27 +0000 Received: from localhost ([127.0.0.1]:57020 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zv6vK-0006m1-Cs for submit@debbugs.gnu.org; Sat, 07 Nov 2015 12:05:26 -0500 Received: from eggs.gnu.org ([208.118.235.92]:34225) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zv354-0000jJ-EF for submit@debbugs.gnu.org; Sat, 07 Nov 2015 07:58:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zv353-0002UO-DM for submit@debbugs.gnu.org; Sat, 07 Nov 2015 07:58:54 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_20 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:54928) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zv353-0002UK-B5 for submit@debbugs.gnu.org; Sat, 07 Nov 2015 07:58:53 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44230) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zv352-0003kU-K0 for bug-guile@gnu.org; Sat, 07 Nov 2015 07:58:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zv34z-0002U1-Df for bug-guile@gnu.org; Sat, 07 Nov 2015 07:58:52 -0500 Received: from mout01.posteo.de ([185.67.36.65]:60026) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zv34z-0002Tx-7b for bug-guile@gnu.org; Sat, 07 Nov 2015 07:58:49 -0500 Received: from dovecot03.posteo.de (dovecot03.posteo.de [172.16.0.13]) by mout01.posteo.de (Postfix) with ESMTPS id ABF4720A2B for ; Sat, 7 Nov 2015 13:58:47 +0100 (CET) Received: from mail.posteo.de (localhost [127.0.0.1]) by dovecot03.posteo.de (Postfix) with ESMTPSA id 3ntJYg2zn2z5vN9 for ; Sat, 7 Nov 2015 13:58:47 +0100 (CET) From: Atticus To: bug-guile@gnu.org Subject: eq? User-Agent: Notmuch/0.21 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-unknown-linux-gnu) Date: Sat, 07 Nov 2015 13:58:48 +0100 Message-ID: <87r3k2ezjr.fsf@posteo.org> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.3 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sat, 07 Nov 2015 12:05:04 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.3 (----) 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). From debbugs-submit-bounces@debbugs.gnu.org Sun Nov 08 05:58:38 2015 Received: (at 21855) by debbugs.gnu.org; 8 Nov 2015 10:58:38 +0000 Received: from localhost ([127.0.0.1]:57280 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZvNgD-0000wl-Qf for submit@debbugs.gnu.org; Sun, 08 Nov 2015 05:58:38 -0500 Received: from mail.tuxteam.de ([5.199.139.25]:41984 helo=tomasium.tuxteam.de) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZvNft-0000w4-Dh for 21855@debbugs.gnu.org; Sun, 08 Nov 2015 05:58:36 -0500 Received: from tomas by tomasium.tuxteam.de with local (Exim 4.80) (envelope-from ) id 1ZvN87-0001fZ-Q0; Sun, 08 Nov 2015 11:23:23 +0100 Date: Sun, 8 Nov 2015 11:23:23 +0100 To: Atticus Subject: Re: bug#21855: eq? Message-ID: <20151108102323.GA5299@tuxteam.de> References: <87r3k2ezjr.fsf@posteo.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; x-action=pgp-signed In-Reply-To: <87r3k2ezjr.fsf@posteo.org> User-Agent: Mutt/1.5.21 (2010-09-15) From: X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 21855 Cc: 21855@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) -----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----- From debbugs-submit-bounces@debbugs.gnu.org Sun Nov 08 08:31:09 2015 Received: (at 21855) by debbugs.gnu.org; 8 Nov 2015 13:31:09 +0000 Received: from localhost ([127.0.0.1]:57360 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZvQ3o-0001wV-Iv for submit@debbugs.gnu.org; Sun, 08 Nov 2015 08:31:08 -0500 Received: from mout01.posteo.de ([185.67.36.65]:48451) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZvQ3T-0001un-1F for 21855@debbugs.gnu.org; Sun, 08 Nov 2015 08:31:07 -0500 Received: from dovecot03.posteo.de (dovecot03.posteo.de [172.16.0.13]) by mout01.posteo.de (Postfix) with ESMTPS id E22CF20946 for <21855@debbugs.gnu.org>; Sun, 8 Nov 2015 14:30:45 +0100 (CET) Received: from mail.posteo.de (localhost [127.0.0.1]) by dovecot03.posteo.de (Postfix) with ESMTPSA id 3ntxD54DCQz5vLS; Sun, 8 Nov 2015 14:30:45 +0100 (CET) From: Atticus To: tomas@tuxteam.de Subject: Re: bug#21855: eq? In-Reply-To: <20151108102323.GA5299@tuxteam.de> References: <87r3k2ezjr.fsf@posteo.org> <20151108102323.GA5299@tuxteam.de> User-Agent: Notmuch/0.21 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-unknown-linux-gnu) Date: Sun, 08 Nov 2015 14:30:42 +0100 Message-ID: <87pozkoby5.fsf@posteo.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 21855 Cc: 21855@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) tomas@tuxteam.de writes: > -----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). Yes you are right that the implementation may treat it as non #f if both arguments refer to the same object. In r5rs (and also r6rs) (eq? '(a) '(a)) is unspecified (r5rs, page 19) and thus implementation dependant but I don't think the behaviour of eq? is consistent in guile. As I said (eq? '(a b) '(a b)) on its own returns #f and imho there is no reason why eq? inside a procedure (in this example in 'multirember') should behave different, since the '(a b) in the second argument does not refer to the '(a b) of the first argument. Since it's not clear if this is a "real" bug, perhaps a further discussion at guile-user@gnu.org would be better. What is the recommended proceeding in such a case? A reply with the pseudo-header "X-Debbugs-CC: guile-user@gnu.org"? Or is that not necessary and a simple mail to guile-user to discuss this topic is sufficient? Btw sorry for the bad bug report, I shoud have read the documentation (didn't include the necessary pseudo-headers) From debbugs-submit-bounces@debbugs.gnu.org Sun Nov 08 09:13:27 2015 Received: (at 21855) by debbugs.gnu.org; 8 Nov 2015 14:13:27 +0000 Received: from localhost ([127.0.0.1]:57366 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZvQik-00031t-Qk for submit@debbugs.gnu.org; Sun, 08 Nov 2015 09:13:27 -0500 Received: from mail.tuxteam.de ([5.199.139.25]:42377 helo=tomasium.tuxteam.de) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZvQii-00031k-9k for 21855@debbugs.gnu.org; Sun, 08 Nov 2015 09:13:25 -0500 Received: from tomas by tomasium.tuxteam.de with local (Exim 4.80) (envelope-from ) id 1ZvQB2-00032V-4n; Sun, 08 Nov 2015 14:38:36 +0100 Date: Sun, 8 Nov 2015 14:38:35 +0100 From: tomas@tuxteam.de To: Atticus Subject: Re: bug#21855: eq? Message-ID: <20151108133835.GA11324@tuxteam.de> References: <87r3k2ezjr.fsf@posteo.org> <20151108102323.GA5299@tuxteam.de> <87pozkoby5.fsf@posteo.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; x-action=pgp-signed In-Reply-To: <87pozkoby5.fsf@posteo.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 21855 Cc: 21855@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Sun, Nov 08, 2015 at 02:30:42PM +0100, Atticus wrote: [...] > Yes you are right that the implementation may treat it as non #f if both > arguments refer to the same object. In r5rs (and also r6rs) (eq? '(a) > '(a)) is unspecified (r5rs, page 19) and thus implementation dependant > but I don't think the behaviour of eq? is consistent in guile. My hunch is that it *can't* be consistent (see below) > As I said > (eq? '(a b) '(a b)) on its own returns #f and imho there is no reason why eq? > inside a procedure (in this example in 'multirember') should behave > different, since the '(a b) in the second argument does not refer to the > '(a b) of the first argument. Modulo vagaries of the optimizer :-) > Since it's not clear if this is a "real" bug, perhaps a further > discussion at guile-user@gnu.org would be better. What is the > recommended proceeding in such a case? A reply with the pseudo-header > "X-Debbugs-CC: guile-user@gnu.org"? Or is that not necessary and a > simple mail to guile-user to discuss this topic is sufficient? Note that I'm not authoritative in this questions, so you'll have to wait on someone with more knowledge than me for a more definiteve answer. But as far as I can gather, those things can get caught in a common subexpression elimination[1] step, and the results will depend on the current optimization strategies. That's why r5rs is vague about that. They (rightfully) don't want to shut off those (in some cases vital) optimizations. The take away (for me, at least) is "use eq? just for symbols", at least unless you know what you are doing. [1] regards - -- t -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAlY/UFsACgkQBcgs9XrR2kaLQwCeKByrAN8ODfbCkIqRt8RMEpNL 9fcAmwTvngBuJ4qSlybyu/miPX8LROiS =or0E -----END PGP SIGNATURE----- From debbugs-submit-bounces@debbugs.gnu.org Mon Nov 09 02:58:15 2015 Received: (at 21855) by debbugs.gnu.org; 9 Nov 2015 07:58:15 +0000 Received: from localhost ([127.0.0.1]:58151 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZvhLD-0004Lr-7O for submit@debbugs.gnu.org; Mon, 09 Nov 2015 02:58:15 -0500 Received: from mout01.posteo.de ([185.67.36.65]:40762) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZvhL9-0004Lg-NS for 21855@debbugs.gnu.org; Mon, 09 Nov 2015 02:58:13 -0500 Received: from dovecot03.posteo.de (dovecot03.posteo.de [172.16.0.13]) by mout01.posteo.de (Postfix) with ESMTPS id 73C99209F3 for <21855@debbugs.gnu.org>; Mon, 9 Nov 2015 08:58:09 +0100 (CET) Received: from mail.posteo.de (localhost [127.0.0.1]) by dovecot03.posteo.de (Postfix) with ESMTPSA id 3nvPnm1RPVz5vND; Mon, 9 Nov 2015 08:58:03 +0100 (CET) From: Atticus To: tomas@tuxteam.de Subject: Re: bug#21855: eq? In-Reply-To: <20151108133835.GA11324@tuxteam.de> References: <87r3k2ezjr.fsf@posteo.org> <20151108102323.GA5299@tuxteam.de> <87pozkoby5.fsf@posteo.org> <20151108133835.GA11324@tuxteam.de> User-Agent: Notmuch/0.21 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-unknown-linux-gnu) Date: Mon, 09 Nov 2015 08:57:59 +0100 Message-ID: <87si4fvc3c.fsf@posteo.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 21855 Cc: 21855@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) tomas@tuxteam.de writes: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On Sun, Nov 08, 2015 at 02:30:42PM +0100, Atticus wrote: > > [...] > >> Yes you are right that the implementation may treat it as non #f if both >> arguments refer to the same object. In r5rs (and also r6rs) (eq? '(a) >> '(a)) is unspecified (r5rs, page 19) and thus implementation dependant >> but I don't think the behaviour of eq? is consistent in guile. > > My hunch is that it *can't* be consistent (see below) > >> As I said >> (eq? '(a b) '(a b)) on its own returns #f and imho there is no reason why eq? >> inside a procedure (in this example in 'multirember') should behave >> different, since the '(a b) in the second argument does not refer to the >> '(a b) of the first argument. > > Modulo vagaries of the optimizer :-) :-) >> Since it's not clear if this is a "real" bug, perhaps a further >> discussion at guile-user@gnu.org would be better. What is the >> recommended proceeding in such a case? A reply with the pseudo-header >> "X-Debbugs-CC: guile-user@gnu.org"? Or is that not necessary and a >> simple mail to guile-user to discuss this topic is sufficient? > > Note that I'm not authoritative in this questions, so you'll have to > wait on someone with more knowledge than me for a more definiteve answer. Ok. > But as far as I can gather, those things can get caught in a common > subexpression elimination[1] step, and the results will depend on the > current optimization strategies. That's why r5rs is vague about that. > They (rightfully) don't want to shut off those (in some cases vital) > optimizations. > > The take away (for me, at least) is "use eq? just for symbols", at > least unless you know what you are doing. > > [1] Thanks for the link; an interesting read. From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 24 11:31:25 2016 Received: (at 21855-done) by debbugs.gnu.org; 24 Jun 2016 15:31:26 +0000 Received: from localhost ([127.0.0.1]:54497 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bGT4n-0006FE-N3 for submit@debbugs.gnu.org; Fri, 24 Jun 2016 11:31:25 -0400 Received: from pb-sasl2.pobox.com ([64.147.108.67]:56862 helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bGT4l-0006F6-Ok for 21855-done@debbugs.gnu.org; Fri, 24 Jun 2016 11:31:24 -0400 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by pb-sasl2.pobox.com (Postfix) with ESMTP id 059B0222A8; Fri, 24 Jun 2016 11:31:21 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=M3EGyf29PbZd9JQt3FkoZUOBY40=; b=ntaZMc iN4B916/K2XjTi5p9XN0+UlVT7nWiSimOer7My8k2djhjt0l4zx09I6q8J7HxVe4 nX6ael/3Gq8SKrlagft/pZI1sx/YtW/tnEQEH/hn8l0hTy2YOuS/hIDCMOHgDr1z hvPuyVAG8Y4NUN0fiWdUi+tvUi0QEMTuSSI5Q= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=wljiIpEy7KL9xslUGS8UNiBPDalASpS0 ImnEG8WD9GyA9q2cOrITv6fDUvNqUD1fLC+m1AeBr4uaHiqLDaAXUbfmnE5wyg7v gFbYqoOPcLUh17k9WeAui0cmLSCVzLzIg4i9SsuO0Ca4ZfPGwQs+XqvEiRdfwz5K 5lacdG2eicI= Received: from pb-sasl2.nyi.icgroup.com (unknown [127.0.0.1]) by pb-sasl2.pobox.com (Postfix) with ESMTP id F0B46222A7; Fri, 24 Jun 2016 11:31:20 -0400 (EDT) Received: from clucks (unknown [88.160.190.192]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by pb-sasl2.pobox.com (Postfix) with ESMTPSA id 3617B222A6; Fri, 24 Jun 2016 11:31:18 -0400 (EDT) From: Andy Wingo To: Subject: Re: bug#21855: eq? References: <87r3k2ezjr.fsf@posteo.org> <20151108102323.GA5299@tuxteam.de> Date: Fri, 24 Jun 2016 17:31:11 +0200 In-Reply-To: <20151108102323.GA5299@tuxteam.de> (tomas@tuxteam.de's message of "Sun, 8 Nov 2015 11:23:23 +0100") Message-ID: <87vb0yeh8g.fsf@pobox.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: B3688DBE-3A20-11E6-99AE-28A6F1301B6D-02397024!pb-sasl2.pobox.com X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 21855-done Cc: Atticus , 21855-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.4 (-) On Sun 08 Nov 2015 11:23, writes: > 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). Tomas is correct; within one compilation unit, constant literals will be deduplicated. That means that within one compilation unit, (eq? '(a b) '(a b)) will indeed be #t.... yarggghhhh.... but: scheme@(guile-user)> (eq? '(a b) '(a b)) $1 = #f scheme@(guile-user)> ,optimize (eq? '(a b) '(a b)) $2 = #f Evidently the optimizer is doing the compare at compile-time, which it is allowed to do, and at compile-time the values are actually distinct. I will see if I can fix that. However Tomas' logic is impeccable :) Closing as things are all working fine, I think. Cheers, Andy From unknown Fri Jun 20 18:21:20 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 23 Jul 2016 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator