From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Gnu Elpa: stream.el: Add some more basic stream operations Date: Thu, 02 Mar 2017 06:00:03 +0100 Message-ID: <87inns6zos.fsf@drachen> References: <87twhbmwbx.fsf@web.de> <878tynl720.fsf@petton.fr> <8737onlapw.fsf@web.de> <87ziqu7ew9.fsf@petton.fr> <87mvmuxuyo.fsf@web.de> <8760tixi99.fsf@web.de> <87twh1kpem.fsf@web.de> <87y42r4d3a.fsf@web.de> <878tug9eh3.fsf@web.de> <87a8es6dcq.fsf@web.de> <87bmz7517d.fsf@web.de> <87shmw76cm.fsf@drachen> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1488430887 18866 195.159.176.226 (2 Mar 2017 05:01:27 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 2 Mar 2017 05:01:27 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: Nicolas Petton , Emacs developers To: Yuri Khan Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Mar 02 06:01:22 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 1cjIrg-0004Cv-PC for ged-emacs-devel@m.gmane.org; Thu, 02 Mar 2017 06:01:20 +0100 Original-Received: from localhost ([::1]:50385 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjIrm-0002Kk-SQ for ged-emacs-devel@m.gmane.org; Thu, 02 Mar 2017 00:01:26 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43883) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjIqh-0002JC-I3 for emacs-devel@gnu.org; Thu, 02 Mar 2017 00:00:22 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cjIqc-0002P4-O8 for emacs-devel@gnu.org; Thu, 02 Mar 2017 00:00:19 -0500 Original-Received: from mout.web.de ([212.227.17.11]:57635) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cjIqc-0002NM-FD for emacs-devel@gnu.org; Thu, 02 Mar 2017 00:00:14 -0500 Original-Received: from drachen.dragon ([109.44.3.195]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MLPaA-1cikcE3TyU-000dAT; Thu, 02 Mar 2017 06:00:09 +0100 In-Reply-To: <87shmw76cm.fsf@drachen> (Michael Heerdegen's message of "Thu, 02 Mar 2017 03:36:09 +0100") X-Provags-ID: V03:K0:+7a5lNiodLrz5HmLxyAuIt0kHS0T9VgNi0fUEwL+PiweTGJ/oQF rNBiFxQ9I0Ovt8ekCXDdC+X9qSTcRwePgiPKZNmThF4gmOaxEv1mSm8REqCnk4WBw3UPcmG bAo76HMPX9R90hvIug2uGmzPdOSfX93QulyCT4N+dcMLu6Lqjq24IqH6jTY7s+nsRpWPuub qvVUUFcn+KmO0HRT9EsgA== X-UI-Out-Filterresults: notjunk:1;V01:K0:lK/Jwgej5gs=:JLFkwIGmfAR0PdWj/yuIJS 5ZX20rP/nXfSC4gbsYH4qtTD8cxb2YAhA61s8EKhoodpPsoMY+mzsLun8E698SZJVsPQlwQ2s +gbf6Lf+r1M32YwUYYliOJ0M7LcgWNX4kpa40JApVTzu95BI6HGDgIujKN63MswSwr0gYvZkr avoXrG98wuPTnNKPGNf+h9UhwuAWuYucgBJzUAbCpZ3j1tcKnXs0UIpL0SxL8HFrv6VN6+J5c 7wWah077iQF55YXgnRNYmZAx7upciCu40KtcMff9vcyY6guw3SPdbNYq8h9QJva6deUmwWjLb 3Fxs4Ns6U6LbdkWbXc+0VVkZnImgbSuRsHFGOyIJ6s/0MT9iJ9V/2Y5+IgPg56cI8fytdD80R hzHKvxsKD4gkro3g7/4czI2IGvKI2iG5smytywmgyHBVXMXasxHXkEiuxGV2G0Omw4tOTIKV5 tK3GR3xYp0t91KNmOuIagylm3ehyrBBzEQdSPMY5mseVL2LNbn+P/cDriM/G5BloW3pk3diwY fLRA4WKdo5XfsKTYnP8YM4D1TbLQHgo1i2vuA2fNXt3r2si4o1Ef43k0YXnulw+3SCYtKyDo2 guhTOQVDXuagCHjfvV0CootiQvf0UYpriKHUrTMnpoeuns/T8Fw9BhuXudK8hXaGDINSPXdFM nkW45WyjnI3rqWLLSecSCQYqeRRBBXP+3M6l9EAWCNcvWRQS5/nLK6//9i8xy6wZgV1+peKKZ 6Kw3s6Tw/xXml3UetsPrj7uEq6fFPUORmw6bfI6hWte5jisw75aKXIpgxYRE2O4ezCZit7xS X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.17.11 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:212689 Archived-At: Michael Heerdegen writes: > > > Would adding an optional argument that allows to specify an upper > > > limit for the indexes the function looks at cover (all of) your > > > concerns? BTW, with the suggested approach, you can use a counter to specify a break condition, like here, were I want to calculate the stream of natural numbers up to a place where two subsequent elements have a difference that is not less than 2 (which never happens), but where I say I want to have at most 25 elements: #+begin_src emacs-lisp (seq-into-sequence (car (stream-divide (let (the-naturals) (setq the-naturals (stream-cons 1 (seq-map #'1+ the-naturals)))) (let ((counter 0)) (lambda (this next) (and (< (cl-incf counter) 25) (< (- next this) 2))))))) ==> (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25) #+end_src (be sure to eval with lexical-binding -> t). Michael.