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 12:17:46 +0200 Message-ID: <878uapy6r9.fsf@gnu.org> References: <87wpyaet7r.fsf@web.de> <87y4iqh7x0.fsf@web.de> <87oajmld49.fsf@gnu.org> <87oajlyif9.fsf@gnu.org> <874mldwt7y.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1436437154 14427 80.91.229.3 (9 Jul 2015 10:19:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 9 Jul 2015 10:19:14 +0000 (UTC) Cc: emacs-devel@gnu.org To: Thierry Volpiatto Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jul 09 12:19:07 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 1ZD8v3-0005Rt-S3 for ged-emacs-devel@m.gmane.org; Thu, 09 Jul 2015 12:19:05 +0200 Original-Received: from localhost ([::1]:38851 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZD8v3-0001nO-CI for ged-emacs-devel@m.gmane.org; Thu, 09 Jul 2015 06:19:05 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40973) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZD8tu-0000v9-Pm for emacs-devel@gnu.org; Thu, 09 Jul 2015 06:17:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZD8to-0002Hc-6L for emacs-devel@gnu.org; Thu, 09 Jul 2015 06:17:54 -0400 Original-Received: from deliver.uni-koblenz.de ([141.26.64.15]:34285) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZD8tn-0002GV-Vq for emacs-devel@gnu.org; Thu, 09 Jul 2015 06:17: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 020C31A838B; Thu, 9 Jul 2015 12:17:46 +0200 (CEST) Mail-Followup-To: Thierry Volpiatto , emacs-devel@gnu.org In-Reply-To: <874mldwt7y.fsf@gmail.com> (Thierry Volpiatto's message of "Thu, 09 Jul 2015 11:55:29 +0200") 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:187787 Archived-At: Thierry Volpiatto writes: >>> 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. > > This would be a regression IMHO, what if you want to do e.g: > > (pcase-let ((`(,a ,b) (file-attributes "foo"))) > (list a b)) > > It would be inconvenient to have to bind the 10 unused remaining > elements. As I've said, you can use cdr-matching with a don't-care-pattern, e.g., (pcase-let ((`(,a ,b . ,_) (file-attributes "~/.emacs"))) (list a b)) which clearly states that you know that the list returned by `file-attributes' has more than two elements but you are only interested in the first two. Bye, Tassilo