From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Amirouche Boubekki Newsgroups: gmane.lisp.guile.user Subject: Re: Custom streams 10x faster than srfi-41 Date: Tue, 06 Sep 2016 19:59:39 +0200 Message-ID: <1f65aa0314229816a1c617903f0ee785@hypermove.net> References: <27b5ca31bf05c1a68615f079cf5276ea@hypermove.net> <428246d2-a4ba-afc6-d4a0-efe7832942bd@thatgeoguy.ca> <6316b7053cdfd6b5eb78639523a8698a@hypermove.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1473185976 18049 195.159.176.226 (6 Sep 2016 18:19:36 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 6 Sep 2016 18:19:36 +0000 (UTC) User-Agent: Roundcube Webmail/1.1.2 Cc: guile-user@gnu.org, guile-user To: jeremy@thatgeoguy.ca Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue Sep 06 20:19:31 2016 Return-path: Envelope-to: guile-user@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 1bhKxt-00031h-OK for guile-user@m.gmane.org; Tue, 06 Sep 2016 20:19:21 +0200 Original-Received: from localhost ([::1]:35339 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhKg6-0008Hl-6d for guile-user@m.gmane.org; Tue, 06 Sep 2016 14:00:58 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57633) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhKff-0008FZ-OY for guile-user@gnu.org; Tue, 06 Sep 2016 14:00:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bhKfb-0007Dv-0c for guile-user@gnu.org; Tue, 06 Sep 2016 14:00:31 -0400 Original-Received: from relay3-d.mail.gandi.net ([2001:4b98:c:538::195]:43181) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhKfR-0007BO-Ix; Tue, 06 Sep 2016 14:00:17 -0400 Original-Received: from mfilter28-d.gandi.net (mfilter28-d.gandi.net [217.70.178.159]) by relay3-d.mail.gandi.net (Postfix) with ESMTP id A9AB3A80EE; Tue, 6 Sep 2016 20:00:11 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter28-d.gandi.net Original-Received: from relay3-d.mail.gandi.net ([IPv6:::ffff:217.70.183.195]) by mfilter28-d.gandi.net (mfilter28-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id VrMtotmHBxTp; Tue, 6 Sep 2016 19:59:40 +0200 (CEST) X-Originating-IP: 10.58.1.147 Original-Received: from webmail.gandi.net (webmail7-d.mgt.gandi.net [10.58.1.147]) (Authenticated sender: amirouche@hypermove.net) by relay3-d.mail.gandi.net (Postfix) with ESMTPA id AE2BBA80E6; Tue, 6 Sep 2016 19:59:39 +0200 (CEST) In-Reply-To: <6316b7053cdfd6b5eb78639523a8698a@hypermove.net> X-Sender: amirouche@hypermove.net X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4b98:c:538::195 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:12880 Archived-At: On 2016-09-05 22:48, Amirouche Boubekki wrote: > On 2016-09-05 21:14, Jeremy Steward wrote: >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA256 >> >> Hey Amirouche, >> >> | (define (lazy-iota count) (let loop ((i 0)) (lambda () (unless (eq? >> | i count) (cons i (loop (1+ i))))))) >> | >> | (define iota3 (lazy-iota 3)) >> | >> | (pk (iota3)) >> | >> | The first time `lazy-iota' is called it returns a procedure that is >> | bound to `count'. Then you can call that procedure to get a pair >> | with the first value and a procedure which will allow to retrieve >> | the rest. >> >> This seems very similar to SRFI 121 (generators) and SRFI 127 (Lazy >> Sequences). > > Thanks for the pointer. > >> Is there something particularly different about this implementation? > > Values generated by traversi-map are chained which means what actually > travels in the stream is the history list of values with the first > value being the last created value. It allows to backtrack to previous > values. (This is not the case of lazy-iota) > > I can't find it anymore in Tinkerpop documentation [0] so maybe it's > not a useful feature. > > [0] http://tinkerpop.apache.org/docs/current/reference/#traversal > As of today, `back` step in gremlin was superseed by `select` step [1]. [1] http://tinkerpop.apache.org/docs/current/reference/#select-step I'd like to add that even if given a traversal that is not a random walk, you can always go back using a reverse traversal so it seems like useless to have a `back` or `backtrack` or `select` step that said it's much easier to use `backtrack` as it's more readable. Right now my implementation doesn't allow to create labels inside the computation chain to backtrack using a name (unlike gremlin). Best regards, amz3