From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Nicolas Petton Newsgroups: gmane.emacs.devel Subject: Re: Stream implementation of seq-mapn Date: Mon, 18 Dec 2017 13:32:17 +0100 Message-ID: <87po7crzce.fsf@petton.fr> References: <87lgi0fdt3.fsf@web.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-Trace: blaine.gmane.org 1513600248 29585 195.159.176.226 (18 Dec 2017 12:30:48 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 18 Dec 2017 12:30:48 +0000 (UTC) Cc: Stefan Monnier To: Michael Heerdegen , Emacs Development Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Dec 18 13:30:44 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eQuZ8-0007Gb-E4 for ged-emacs-devel@m.gmane.org; Mon, 18 Dec 2017 13:30:42 +0100 Original-Received: from localhost ([::1]:58233 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQub4-0002NN-Rv for ged-emacs-devel@m.gmane.org; Mon, 18 Dec 2017 07:32:42 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56513) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQuam-0002Jn-Km for emacs-devel@gnu.org; Mon, 18 Dec 2017 07:32:30 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQuaj-0003Ay-D1 for emacs-devel@gnu.org; Mon, 18 Dec 2017 07:32:24 -0500 Original-Received: from petton.fr ([89.234.186.68]:52600) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eQuaj-0003A4-2j for emacs-devel@gnu.org; Mon, 18 Dec 2017 07:32:21 -0500 In-Reply-To: <87lgi0fdt3.fsf@web.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=petton.fr; s=mail; t=1513600339; bh=9KOtcaqG+rpPE8x0iDbCDfx6fXN0F9E3JaMbk+1wAOo=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID:MIME-Version:Content-Type; b=R50A2+TGTfVtbTvzfs3Luy+QLTSD00O77EjboK2iw/+NnkP5gmo1odbPnnBLi97FdS7iNb9joE3emwYsTWemXraK7Ntq4O24KN80HeOuMTDYmMts3vC7rwKbgmoO8XofkEnJaVzsJRgYCIuCWjhJqh5Jn2Y6mlyOj3OPVs5kytQ= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 89.234.186.68 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:221213 Archived-At: --=-=-= Content-Type: text/plain Michael Heerdegen writes: Hi Michael, > [...] > +(cl-defmethod seq-mapn (function (stream stream) &rest streams) > + "Map FUNCTION over the STREAMS. I would add to the docstring that all elements of `streams' should be streams, otherwise it will default to the generic implementation. > + > +Example: this prints the first ten Fibonacci numbers: > + > + (letrec ((fibs (stream-cons > + 1 > + (stream-cons > + 1 > + (seq-mapn #'+ fibs (stream-rest fibs)))))) > + (seq-do #'print (seq-take fibs 10))) > + > +\(fn FUNCTION STREAMS...)" > + (if (not (cl-every #'streamp streams)) ^^^^^^^^ Since this is for stream.el, why not use `seq-every-p'? > + (cl-call-next-method) > + (cl-callf2 cons stream streams) > + (stream-make > + (unless (cl-some #'seq-empty-p streams) ^^^^^^^ Same question :-) > [...] > (1) Is it ok to implement it with `cl-call-next-method' this way? I guess it is. Have you tried running `seq-mapn' with a mix of streams and lists? Cheers, Nico --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEKNO+2FH986tX/vk8IzWHpHwgeRAFAlo3tVEACgkQIzWHpHwg eRDrIgf9GFC206HaJK0++Dy90iSzlcfxm1MRWpmJfmZoqtrkkx7qmJIE0veHhB89 HvVxbhI2JhV90WFwKGYg01trMkMtva5oG2+/jJnn6dQqHGeGLo88wYzkO+vcU4jD 7t1l9amcKO8v4CIc4B2Y2MaZVVT2oLRh1pFfc5fjbQG4dUJNgFHdZ6Drpfb1erWq CTeSbFiqI+lZ1aGxskY7FXchGboUV5kRReaaJIGOitSFEU5cNqZsZRhCB4k9XYdn zVKSWv7RWjatxm06bvbjFqE6Wp1oNFoDzlrBU4m226MhlZE0IoRmlJjtE3HBBbqr XNbmxteIAXx5YEIa/XVxMNd16/bhcQ== =QQ4+ -----END PGP SIGNATURE----- --=-=-=--