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 c13a4df: Remove the calls to `seq-into` from `seq-concatenate` Date: Tue, 25 Aug 2015 17:52:47 -0400 Message-ID: References: <20150823191413.17383.23210@vcs.savannah.gnu.org> <87k2skaj5y.fsf@petton.fr> <878u8zahu9.fsf@petton.fr> <87vbc3toez.fsf@petton.fr> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1440539605 10809 80.91.229.3 (25 Aug 2015 21:53:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 25 Aug 2015 21:53:25 +0000 (UTC) Cc: emacs-devel@gnu.org To: Nicolas Petton Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Aug 25 23:53:10 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 1ZUM9T-0007jB-C1 for ged-emacs-devel@m.gmane.org; Tue, 25 Aug 2015 23:53:07 +0200 Original-Received: from localhost ([::1]:34748 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUM9S-0002Ks-Ic for ged-emacs-devel@m.gmane.org; Tue, 25 Aug 2015 17:53:06 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52453) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUM9F-0002Ji-5Q for emacs-devel@gnu.org; Tue, 25 Aug 2015 17:52:54 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZUM9B-00083H-W8 for emacs-devel@gnu.org; Tue, 25 Aug 2015 17:52:53 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:60379) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUM9B-00082r-SU for emacs-devel@gnu.org; Tue, 25 Aug 2015 17:52:49 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0AsEwA731xV/5P+d0tcgxCEAoVVuzcJh0sEAgKBPDkUAQEBAQEBAYEKQQWDXQEBAwFWIxALNBIUGA0kLogJCM8jAQEBBwIBH4s6hQUHhC0Fsz+BRSOBZiQcFYFZIoJ4AQEB X-IPAS-Result: A0AsEwA731xV/5P+d0tcgxCEAoVVuzcJh0sEAgKBPDkUAQEBAQEBAYEKQQWDXQEBAwFWIxALNBIUGA0kLogJCM8jAQEBBwIBH4s6hQUHhC0Fsz+BRSOBZiQcFYFZIoJ4AQEB X-IronPort-AV: E=Sophos;i="5.13,465,1427774400"; d="scan'208";a="161372433" Original-Received: from 75-119-254-147.dsl.teksavvy.com (HELO ceviche.home) ([75.119.254.147]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 25 Aug 2015 17:52:48 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id D56196620D; Tue, 25 Aug 2015 17:52:47 -0400 (EDT) In-Reply-To: <87vbc3toez.fsf@petton.fr> (Nicolas Petton's message of "Tue, 25 Aug 2015 16:48:04 +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:189174 Archived-At: >>> Yes, it is still a problem. One solution would be to test if the seq is >>> a cl-struct with, in which case we could use `seq-into'. But then that >>> would only fix the cl-struct case, not any other. >> If we make it into a defmethod, at least it would be possible for >> specific cl-structs to fix the problem. > It is already, or did you mean something else? But how would you do it > here? There can be any number of sequences. That's exactly the issue: it needs to be structured so that callers can usefully override it. As it is currently defined, the only overriding possible is to provide new valid values for the `type' argument. So its default definition should make use of seq-into or something similar so that new types can provide their own implementation. E.g., you could define a new (cl-defgeneric seq-into-sequence (seq) (if (sequencep seq) seq (error "Don't know how to turn %S into a sequence" seq))) and then (cl-defgeneric seq-concatenate (type &rest seqs) (apply #'cl-concatenate type (mapcar #'seq-into-sequence seqs))) Stefan