From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.devel Subject: Semantic of pcase `seq' and `map' patterns (was: pcase-setq) Date: Mon, 12 Oct 2015 14:49:19 +0200 Message-ID: <874mhwxne8.fsf_-_@web.de> References: <87wpyaet7r.fsf@web.de> <87y4iqh7x0.fsf@web.de> <87oajmld49.fsf@gnu.org> <87oajlyif9.fsf@gnu.org> <87a8v53wll.fsf@web.de> <87k2qsxr73.fsf_-_@web.de> <87bnc4mh2q.fsf@petton.fr> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1444654266 32016 80.91.229.3 (12 Oct 2015 12:51:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 12 Oct 2015 12:51:06 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Oct 12 14:50:58 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 1ZlcYq-0002hy-Bh for ged-emacs-devel@m.gmane.org; Mon, 12 Oct 2015 14:50:40 +0200 Original-Received: from localhost ([::1]:55155 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZlcYp-0006vy-Np for ged-emacs-devel@m.gmane.org; Mon, 12 Oct 2015 08:50:39 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37539) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZlcYQ-0006jg-DD for emacs-devel@gnu.org; Mon, 12 Oct 2015 08:50:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZlcYM-0007lj-B9 for emacs-devel@gnu.org; Mon, 12 Oct 2015 08:50:14 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:48889) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZlcYM-0007ld-4g for emacs-devel@gnu.org; Mon, 12 Oct 2015 08:50:10 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1ZlcXz-00020f-Go for emacs-devel@gnu.org; Mon, 12 Oct 2015 14:49:47 +0200 Original-Received: from ip-90-186-2-115.web.vodafone.de ([90.186.2.115]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 12 Oct 2015 14:49:47 +0200 Original-Received: from michael_heerdegen by ip-90-186-2-115.web.vodafone.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 12 Oct 2015 14:49:47 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 38 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: ip-90-186-2-115.web.vodafone.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) Cancel-Lock: sha1:5GjgI3E26al/CrhELPyIFtYZlHY= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 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:191329 Archived-At: Nicolas Petton writes: > (seq-let (a b (c &rest others)) '(1 2 [3 4 5 6]) > (+ a b c)) After reading the doc of the `seq' pcase pattern: --8<---------------cut here---------------start------------->8--- -- (seq &rest ARGS) pcase pattern matching sequence elements. Matches if the object is a sequence (list, string or vector), and binds each element of ARGS to the corresponding element of the sequence. --8<---------------cut here---------------end--------------->8--- it was not obvious to me how this example would look like using pcase - especially, what "are" the "ARGS"? AFAIU the "ARGS" are just normal (pcase) patterns - they are not limited to variables, and matching can fail for them as well even if the number of sequence arguments would match. I think the semantic would be better described like this: --8<---------------cut here---------------start------------->8--- -- (seq &rest PATTERNS) pcase pattern matching sequence elements. Matches if the object is a sequence (list, string or vector), and each PATTERN matches the corresponding element of the sequence. --8<---------------cut here---------------end--------------->8--- Does that make sense? Likewise `map', I guess. Michael.