From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] master 387e1e1: New version of `seq-let' based on a pcase pattern Date: Mon, 11 May 2015 11:06:31 -0400 Message-ID: References: <20150510182502.23307.63648@vcs.savannah.gnu.org> <874mnjdycw.fsf@petton.fr> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1431356828 7360 80.91.229.3 (11 May 2015 15:07:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 11 May 2015 15:07:08 +0000 (UTC) Cc: emacs-devel@gnu.org To: Nicolas Petton Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon May 11 17:07:00 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 1YrpIK-0001tD-3N for ged-emacs-devel@m.gmane.org; Mon, 11 May 2015 17:07:00 +0200 Original-Received: from localhost ([::1]:38069 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YrpIJ-0004aH-8f for ged-emacs-devel@m.gmane.org; Mon, 11 May 2015 11:06:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41019) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YrpHv-0004Ul-Po for emacs-devel@gnu.org; Mon, 11 May 2015 11:06:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YrpHt-0004NC-13 for emacs-devel@gnu.org; Mon, 11 May 2015 11:06:35 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:55504) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YrpHs-0004N0-UX for emacs-devel@gnu.org; Mon, 11 May 2015 11:06:32 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgUFAGvvdVRFpYts/2dsb2JhbAA3gVOhb4EIgXUBAQQBViMFCws0EhQYDSSIE6IRi3UXF0EMA4M+A4NwBKNjhFg X-IPAS-Result: AgUFAGvvdVRFpYts/2dsb2JhbAA3gVOhb4EIgXUBAQQBViMFCws0EhQYDSSIE6IRi3UXF0EMA4M+A4NwBKNjhFg X-IronPort-AV: E=Sophos;i="5.11,557,1422939600"; d="scan'208";a="119169340" Original-Received: from 69-165-139-108.dsl.teksavvy.com (HELO pastel.home) ([69.165.139.108]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 11 May 2015 11:06:32 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id F0FFF1E12; Mon, 11 May 2015 11:06:31 -0400 (EDT) In-Reply-To: <874mnjdycw.fsf@petton.fr> (Nicolas Petton's message of "Mon, 11 May 2015 15:42:39 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 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:186409 Archived-At: > Yes. My idea of it was that you bind a sequence like the following: > (seq [a b [c d]]) I was thinking of (seq a b (seq c d)). You could add support for (seq a b [c d]), if you want since that currently wouldn't collide with any pcase pattern, tho I'm not sure it's worth the added complexity for the user. > But then how can I have `seq-let' work the way it did until now? For > instance: > (seq-let [a [b [c]]] my-vector > ...) You expand [a [b [c]]] to (seq a (seq b (seq c))) before passing it to pcase-let. >>> + (push `(app (seq--reverse-args #'seq--nested-elt >>> + (reverse (cons ,index ',nested-indexes))) >>> + ,name) >> This reverse plus seq--reverse-args business seems >> hideously inefficient. Why do you need that? > because of the way the `app' pattern works. Or maybe I'm missing > something? Why wouldn't `(app (seq--nested-elt ',(reverse (cons index nested-indexes))) ,name) work as well? Or, once you get rid of the nested case, `(app (seq-elt ,index) ,name) -- Stefan