guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Custom streams 10x faster than srfi-41


From: Amirouche Boubekki
Subject: Re: Custom streams 10x faster than srfi-41
Date: Tue, 06 Sep 2016 19:59:39 +0200
User-agent: Roundcube Webmail/1.1.2

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]