<div dir="ltr">Thanks for the feedback Christos, those are helpful.I also learned something from Bill's feedback, all this time I'd been butting unneeded begin statements inside cond for blocks all this time, haha!<div><br></div><div>I plan to have a subsequent major part with the sort of snippets, advanced use, and s7 specific goodies too. I'll certainly share those as they come up as there is likely to be more suboptimal handling in them by me!<div><br></div><div>iain</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Mar 24, 2021 at 12:52 PM Christos Vagias <<a href="mailto:chris.actondev@gmail.com">chris.actondev@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Congratulations Iain! Amazing work!<br>
<br>
By taking a quick look I also learned something! Didn't know that map<br>
can operate on more than one list<br>
(or more generally, more than one iteratables). Quite the<br>
embarrassment having worked quite some time<br>
with scheme/clojure. That makes writing sth like map-indexed<br>
(a-la-clojure) really trivial (and unnecessary).<br>
<br>
Would like to share some snippets, you might find them interesting.<br>
Also, they touch the "iterator" concept in s7,<br>
which is worth mentioning.<br>
<br>
(define* (lazy-range (n +inf.0) (start 0) (step 1))<br>
(let ((+iterator+ #t)<br>
(i start)<br>
(counter 0))<br>
(lambda ()<br>
(let ((res i))<br>
(if (= counter n)<br>
#<eof><br>
(begin<br>
(set! i (+ step i))<br>
(set! counter (+ 1 counter))<br>
res))))))<br>
<br>
(is equivalent? '(0 1 2) (map values (lazy-range 3)))<br>
<br>
(test "lazy range: can be used for map-indexed "<br>
(is equivalent? '(a 0 b 1)<br>
(map (lambda (x y)<br>
(values x y))<br>
'(a b)<br>
(lazy-range)))<br>
(is equivalent? '(0 a 1 b)<br>
(map (lambda (x y)<br>
(values x y))<br>
(lazy-range)<br>
'(a b))))<br>
<br>
And some more clojure-inspired bits<br>
<br>
(define (take n lazy-seq)<br>
(map (lambda (_ x) x)<br>
(range n)<br>
lazy-seq))<br>
<br>
(test "take x from lazy-seq"<br>
(define seq (lazy-range 8))<br>
(is equivalent? '(0 1 2) (take 3 seq))<br>
(is equivalent? '(3 4 5) (take 3 seq))<br>
(is equivalent? '(6 7) (take 3 seq)))<br>
<br>
<br>
Also, a small suggestion (wrt the map list.. (length fruits) that you<br>
have in the book),<br>
would be to comment against calling length on lists.<br>
This causes traversing the whole (linked) list to find the length.In vectors<br>
though it'd be fine.<br>
<br>
<br>
On Tue, 23 Mar 2021 at 17:20, Iain Duncan <<a href="mailto:iainduncanlists@gmail.com" target="_blank">iainduncanlists@gmail.com</a>> wrote:<br>
><br>
> Thanks, it could very well be helpful! When I first started the hunt I was only looking at Max resources so never found that.<br>
><br>
> thanks Forrest.<br>
> iain<br>
><br>
> On Tue, Mar 23, 2021 at 9:12 AM Forrest Curo <<a href="mailto:treegestalt@gmail.com" target="_blank">treegestalt@gmail.com</a>> wrote:<br>
>><br>
>> Is this useful? -- <a href="https://github.com/etienne-p/Pd_Scheme" rel="noreferrer" target="_blank">https://github.com/etienne-p/Pd_Scheme</a><br>
>><br>
>> On Mon, Mar 22, 2021 at 9:39 PM Iain Duncan <<a href="mailto:iainduncanlists@gmail.com" target="_blank">iainduncanlists@gmail.com</a>> wrote:<br>
>>><br>
>>> hi Forrest, I will be doing a port to PureData starting in a few weeks, it's been approved for my thesis project so it will definitely happen. But at present this has nothing to do with any existing pd scheme objects. Everything in it *will* be relevant to the Pd port though when it happens! I would anticipate the Pd port will happen this summer, with some early limited versions out in the next couple of months.<br>
>>><br>
>>> iain<br>
>>><br>
>>> On Mon, Mar 22, 2021 at 8:37 PM Forrest Curo <<a href="mailto:treegestalt@gmail.com" target="_blank">treegestalt@gmail.com</a>> wrote:<br>
>>>><br>
>>>> Is this applicable to Pure Data?<br>
>>>><br>
>>>> I see that there are a few references to a pd-scheme object; I don't know how well that works(?)<br>
>>>><br>
>>>> On Mon, Mar 22, 2021 at 6:42 PM Iain Duncan <<a href="mailto:iainduncanlists@gmail.com" target="_blank">iainduncanlists@gmail.com</a>> wrote:<br>
>>>>><br>
>>>>> Hi folks, I've got a first draft of my beginner friendly guide to s7 for Scheme For Max up now. If any experienced folks feel like giving it a gander, I'd love feedback, error corrections, suggestions, etc! It's meant to be a fast-moving crash course to get the new Schemer working productively as quickly as possible.<br>
>>>>><br>
>>>>> Book:<br>
>>>>> <a href="https://iainctduncan.github.io/learn-scheme-for-max/" rel="noreferrer" target="_blank">https://iainctduncan.github.io/learn-scheme-for-max/</a><br>
>>>>><br>
>>>>> File issues for feedback here:<br>
>>>>> <a href="https://github.com/iainctduncan/learn-scheme-for-max" rel="noreferrer" target="_blank">https://github.com/iainctduncan/learn-scheme-for-max</a><br>
>>>>><br>
>>>>> Thanks!<br>
>>>>> iain<br>
>>>>> _______________________________________________<br>
>>>>> Cmdist mailing list<br>
>>>>> <a href="mailto:Cmdist@ccrma.stanford.edu" target="_blank">Cmdist@ccrma.stanford.edu</a><br>
>>>>> <a href="https://cm-mail.stanford.edu/mailman/listinfo/cmdist" rel="noreferrer" target="_blank">https://cm-mail.stanford.edu/mailman/listinfo/cmdist</a><br>
>><br>
>> _______________________________________________<br>
>> Cmdist mailing list<br>
>> <a href="mailto:Cmdist@ccrma.stanford.edu" target="_blank">Cmdist@ccrma.stanford.edu</a><br>
>> <a href="https://cm-mail.stanford.edu/mailman/listinfo/cmdist" rel="noreferrer" target="_blank">https://cm-mail.stanford.edu/mailman/listinfo/cmdist</a><br>
><br>
> _______________________________________________<br>
> Cmdist mailing list<br>
> <a href="mailto:Cmdist@ccrma.stanford.edu" target="_blank">Cmdist@ccrma.stanford.edu</a><br>
> <a href="https://cm-mail.stanford.edu/mailman/listinfo/cmdist" rel="noreferrer" target="_blank">https://cm-mail.stanford.edu/mailman/listinfo/cmdist</a><br>
</blockquote></div>