From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] pcase.el: Add type pattern Date: Tue, 10 Mar 2020 12:10:05 -0700 Message-ID: <87zhcovxf6.fsf@ericabrahamsen.net> References: <874kuxxuez.fsf@alphapapa.net> <87r1y1wcj4.fsf@alphapapa.net> <87h7yxw5x1.fsf@alphapapa.net> <87a74puq1q.fsf@web.de> <87d09lw3id.fsf@alphapapa.net> <87zhcoqmmz.fsf@web.de> <87wo7s8b73.fsf@alphapapa.net> <87eeu0qisn.fsf@web.de> <87o8t487mb.fsf@alphapapa.net> <871rq0qf5w.fsf@web.de> <87h7yw84sb.fsf@alphapapa.net> <87d09k8477.fsf@alphapapa.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="71094"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) To: emacs-devel@gnu.org Cancel-Lock: sha1:k/YhAO/HQLJ8IlQ9ofk5wiFayGQ= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Mar 10 20:11:17 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jBkHd-000IO5-6s for ged-emacs-devel@m.gmane-mx.org; Tue, 10 Mar 2020 20:11:17 +0100 Original-Received: from localhost ([::1]:38948 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBkHc-0004XM-7j for ged-emacs-devel@m.gmane-mx.org; Tue, 10 Mar 2020 15:11:16 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36255) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBkGf-0003XP-37 for emacs-devel@gnu.org; Tue, 10 Mar 2020 15:10:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jBkGd-0006rs-Vk for emacs-devel@gnu.org; Tue, 10 Mar 2020 15:10:16 -0400 Original-Received: from ciao.gmane.io ([159.69.161.202]:54710) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jBkGd-0006dl-Ov for emacs-devel@gnu.org; Tue, 10 Mar 2020 15:10:15 -0400 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1jBkGa-000GzR-Sx for emacs-devel@gnu.org; Tue, 10 Mar 2020 20:10:12 +0100 X-Injected-Via-Gmane: http://gmane.org/ X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 159.69.161.202 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:245442 Archived-At: Adam Porter writes: > Hi Michael, > > Adam Porter writes: > >>>> 1. Run emacs -Q. >>>> 2. Evaluate this form in *scratch*: >>>> >>>> (pcase-defmacro type (type) >>>> "Pcase pattern that matches objects of TYPE. >>>> TYPE is a symbol or list as accepted by `cl-typep', which see." >>>> `(pred (pcase--flip cl-typep ',type))) >>>> >>>> 3. Evaluate this form in *scratch*: >>>> >>>> (macroexpand-all '(pcase 10 ((type (integer 0 10)) t))) >>>> >>>> Result: >>>> >>>> (if (and (integerp 10) (>= 10 (quote 0)) (<= 10 (quote 10))) (progn t) >>>> nil) >>> >>> No, I don't see that here. I'm using current master here. >> >> Hm, I don't know how to explain that. I guess I'll have to rebuild >> master and check again. > > Here are the steps I just followed: > > 1. Pull master and rebase my patch on it. > 2. ./configure && make && src/emacs -Q. > 3. Evaluate this expression, in both *scratch* and M-:, which give the > same result: > > (macroexpand-all '(pcase 10 ((type (integer 0 10)) t))) > > Result: > > (if (and (integerp 10) (>= 10 '0) (<= 10 '10)) (progn t) nil) > > I can't explain why you get a different result. FWIW, I get the same. `if' when there's only one branch, `cond' when there's more.