From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andreas Schwab Newsgroups: gmane.emacs.devel Subject: Re: Question on pcase Date: Mon, 26 Oct 2015 17:35:40 +0100 Message-ID: References: <871tcngdv2.fsf@gmail.com> <87k2qe1u09.fsf@web.de> <83r3kmrtat.fsf@gnu.org> <87r3kl22zk.fsf@web.de> <837fmdzpf2.fsf@gnu.org> <87oafp659p.fsf@web.de> <831tclzly9.fsf@gnu.org> <87fv115t20.fsf@web.de> <87io5tzkt8.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1445877374 28096 80.91.229.3 (26 Oct 2015 16:36:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 26 Oct 2015 16:36:14 +0000 (UTC) Cc: Michael Heerdegen , Eli Zaretskii , Emacs Development To: Oleh Krehel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Oct 26 17:35:59 2015 Return-path: Envelope-to: ged-emacs-devel@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 1ZqkkX-0000VD-Lm for ged-emacs-devel@m.gmane.org; Mon, 26 Oct 2015 17:35:57 +0100 Original-Received: from localhost ([::1]:54012 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZqkkW-0003fD-SX for ged-emacs-devel@m.gmane.org; Mon, 26 Oct 2015 12:35:56 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52407) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZqkkS-0003e8-Bl for emacs-devel@gnu.org; Mon, 26 Oct 2015 12:35:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZqkkN-0003el-IW for emacs-devel@gnu.org; Mon, 26 Oct 2015 12:35:52 -0400 Original-Received: from mx2.suse.de ([195.135.220.15]:39159) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZqkkH-0003ct-MS; Mon, 26 Oct 2015 12:35:41 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Original-Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 4645DAAF4; Mon, 26 Oct 2015 16:35:31 +0000 (UTC) X-Yow: I love FRUIT PICKERS!! In-Reply-To: <87io5tzkt8.fsf@gmail.com> (Oleh Krehel's message of "Mon, 26 Oct 2015 16:55:15 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:192667 Archived-At: Oleh Krehel writes: > But the code that binds the variables, e.g. (setq thing x) will likely > be hard to implement. For instance, look at this example with macroexpand: > > (setq test '(1 . 2)) > (pcase test > (`(,foo . ,baz) > (cons baz foo))) > ;; => > ;; (2 . 1) > > (macroexpand '(pcase test > (`(,foo . ,baz) > (cons baz foo)))) > ;; => > ;; (if (consp test) > ;; (let* ((x (car test)) > ;; (x (cdr test))) > ;; (let ((baz x) > ;; (foo x)) > ;; (cons baz foo))) > ;; nil) > > The macroexpanded code returns (2 . 2) when evaluated. This I don't > understand. Try binding print-gensym and print-circle to non-nil while the form is printed. Andreas. -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."