From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.bugs Subject: bug#21855: eq? Date: Fri, 24 Jun 2016 17:31:11 +0200 Message-ID: <87vb0yeh8g.fsf@pobox.com> References: <87r3k2ezjr.fsf@posteo.org> <20151108102323.GA5299@tuxteam.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1466782354 3560 80.91.229.3 (24 Jun 2016 15:32:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 24 Jun 2016 15:32:34 +0000 (UTC) Cc: Atticus , 21855-done@debbugs.gnu.org To: Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Fri Jun 24 17:32:25 2016 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bGT5g-0004hc-0N for guile-bugs@m.gmane.org; Fri, 24 Jun 2016 17:32:20 +0200 Original-Received: from localhost ([::1]:44323 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGT5f-0000GS-BV for guile-bugs@m.gmane.org; Fri, 24 Jun 2016 11:32:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52644) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGT5U-0000El-B2 for bug-guile@gnu.org; Fri, 24 Jun 2016 11:32:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bGT5O-00089J-J5 for bug-guile@gnu.org; Fri, 24 Jun 2016 11:32:08 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:42162) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGT5O-00089E-Fm for bug-guile@gnu.org; Fri, 24 Jun 2016 11:32:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bGT5O-0006GH-B1 for bug-guile@gnu.org; Fri, 24 Jun 2016 11:32:02 -0400 Resent-From: Andy Wingo Original-Sender: "Debbugs-submit" Resent-To: bug-guile@gnu.org Resent-Date: Fri, 24 Jun 2016 15:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 21855 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Mail-Followup-To: 21855@debbugs.gnu.org, wingo@pobox.com, atticus0@posteo.org Original-Received: via spool by 21855-done@debbugs.gnu.org id=D21855.146678228624013 (code D ref 21855); Fri, 24 Jun 2016 15:32:02 +0000 Original-Received: (at 21855-done) by debbugs.gnu.org; 24 Jun 2016 15:31:26 +0000 Original-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 Original-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 Original-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= Original-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) Original-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) In-Reply-To: <20151108102323.GA5299@tuxteam.de> (tomas@tuxteam.de's message of "Sun, 8 Nov 2015 11:23:23 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) X-Pobox-Relay-ID: B3688DBE-3A20-11E6-99AE-28A6F1301B6D-02397024!pb-sasl2.pobox.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.org gmane.lisp.guile.bugs:8229 Archived-At: 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