From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.devel Subject: Re: pcase-dolist Date: Thu, 09 Jul 2015 08:05:46 +0200 Message-ID: <87oajlyif9.fsf@gnu.org> References: <87wpyaet7r.fsf@web.de> <87y4iqh7x0.fsf@web.de> <87oajmld49.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1436421966 5420 80.91.229.3 (9 Jul 2015 06:06:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 9 Jul 2015 06:06:06 +0000 (UTC) Cc: Michael Heerdegen , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jul 09 08:05:57 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 1ZD4y3-00047k-UM for ged-emacs-devel@m.gmane.org; Thu, 09 Jul 2015 08:05:56 +0200 Original-Received: from localhost ([::1]:37940 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZD4y3-0008NW-4C for ged-emacs-devel@m.gmane.org; Thu, 09 Jul 2015 02:05:55 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53491) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZD4xz-0008NQ-7D for emacs-devel@gnu.org; Thu, 09 Jul 2015 02:05:52 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZD4xw-00065U-2M for emacs-devel@gnu.org; Thu, 09 Jul 2015 02:05:51 -0400 Original-Received: from deliver.uni-koblenz.de ([141.26.64.15]:48681) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZD4xv-00065M-TO for emacs-devel@gnu.org; Thu, 09 Jul 2015 02:05:48 -0400 Original-Received: from thinkpad-t440p (dhcp172.uni-koblenz.de [141.26.71.172]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by deliver.uni-koblenz.de (Postfix) with ESMTPSA id 2DCC31A836A; Thu, 9 Jul 2015 08:05:47 +0200 (CEST) Mail-Followup-To: Stefan Monnier , Michael Heerdegen , emacs-devel@gnu.org In-Reply-To: (Stefan Monnier's message of "Wed, 08 Jul 2015 17:27:47 -0400") User-Agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 141.26.64.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:187785 Archived-At: Stefan Monnier writes: >> (pcase-let ((`(,w ,x ,y ,z) '(1 2 3))) >> (message "%s %s %s %s" w x y z)) > >> prints "1 2 3 nil" although the pattern when used in `pcase' wouldn't >> match that list but only 4-element lists. So a pcase pattern has >> different semantics depending on whether it is used in `pcase' or >> `pcase-let' or `pcase-dolist' which doesn't feel right. > >> I'd prefer if `pcase-let' would signal an error if some pattern doesn't >> match. > > So you'd want the above to signal an error in the case of: > > (pcase-let ((`(,w ,x) '(1 2 3))) > (message "%s %s" w x)) > > ? Yes, if you want to pick the first two elements of a list with 2 or more elements, you should use `(,w ,x . ,_). I see that the above is slightly more convenient and concise but I'd value consistency more. Bye, Tassilo