<div dir="ltr">Thanks for the feedback Christos, those are helpful.I also learned something from Bill&#39;s feedback, all this time I&#39;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&#39;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 &lt;<a href="mailto:chris.actondev@gmail.com">chris.actondev@gmail.com</a>&gt; 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&#39;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 &quot;iterator&quot; 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>
            #&lt;eof&gt;<br>
            (begin<br>
              (set! i (+ step i))<br>
              (set! counter (+ 1 counter))<br>
              res))))))<br>
<br>
(is equivalent? &#39;(0 1 2) (map values (lazy-range 3)))<br>
<br>
(test &quot;lazy range: can be used for map-indexed &quot;<br>
      (is equivalent? &#39;(a 0 b 1)<br>
          (map (lambda  (x y)<br>
                 (values x y))<br>
               &#39;(a b)<br>
               (lazy-range)))<br>
      (is equivalent? &#39;(0 a 1 b)<br>
          (map (lambda  (x y)<br>
                 (values x y))<br>
               (lazy-range)<br>
               &#39;(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 &quot;take x from lazy-seq&quot;<br>
      (define seq (lazy-range 8))<br>
      (is equivalent? &#39;(0 1 2) (take 3 seq))<br>
      (is equivalent? &#39;(3 4 5) (take 3 seq))<br>
      (is equivalent? &#39;(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&#39;d be fine.<br>
<br>
<br>
On Tue, 23 Mar 2021 at 17:20, Iain Duncan &lt;<a href="mailto:iainduncanlists@gmail.com" target="_blank">iainduncanlists@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt; 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>
&gt;<br>
&gt; thanks Forrest.<br>
&gt; iain<br>
&gt;<br>
&gt; On Tue, Mar 23, 2021 at 9:12 AM Forrest Curo &lt;<a href="mailto:treegestalt@gmail.com" target="_blank">treegestalt@gmail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; 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>
&gt;&gt;<br>
&gt;&gt; On Mon, Mar 22, 2021 at 9:39 PM Iain Duncan &lt;<a href="mailto:iainduncanlists@gmail.com" target="_blank">iainduncanlists@gmail.com</a>&gt; wrote:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; hi Forrest, I will be doing a port to PureData starting in a few weeks, it&#39;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>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; iain<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; On Mon, Mar 22, 2021 at 8:37 PM Forrest Curo &lt;<a href="mailto:treegestalt@gmail.com" target="_blank">treegestalt@gmail.com</a>&gt; wrote:<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Is this applicable to Pure Data?<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; I see that there are a few references to a pd-scheme object; I don&#39;t know how well that works(?)<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; On Mon, Mar 22, 2021 at 6:42 PM Iain Duncan &lt;<a href="mailto:iainduncanlists@gmail.com" target="_blank">iainduncanlists@gmail.com</a>&gt; wrote:<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; Hi folks, I&#39;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&#39;d love feedback, error corrections, suggestions, etc! It&#39;s meant to be a fast-moving crash course to get the new Schemer working productively as quickly as possible.<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; Book:<br>
&gt;&gt;&gt;&gt;&gt; <a href="https://iainctduncan.github.io/learn-scheme-for-max/" rel="noreferrer" target="_blank">https://iainctduncan.github.io/learn-scheme-for-max/</a><br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; File issues for feedback here:<br>
&gt;&gt;&gt;&gt;&gt; <a href="https://github.com/iainctduncan/learn-scheme-for-max" rel="noreferrer" target="_blank">https://github.com/iainctduncan/learn-scheme-for-max</a><br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; Thanks!<br>
&gt;&gt;&gt;&gt;&gt; iain<br>
&gt;&gt;&gt;&gt;&gt; _______________________________________________<br>
&gt;&gt;&gt;&gt;&gt; Cmdist mailing list<br>
&gt;&gt;&gt;&gt;&gt; <a href="mailto:Cmdist@ccrma.stanford.edu" target="_blank">Cmdist@ccrma.stanford.edu</a><br>
&gt;&gt;&gt;&gt;&gt; <a href="https://cm-mail.stanford.edu/mailman/listinfo/cmdist" rel="noreferrer" target="_blank">https://cm-mail.stanford.edu/mailman/listinfo/cmdist</a><br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; Cmdist mailing list<br>
&gt;&gt; <a href="mailto:Cmdist@ccrma.stanford.edu" target="_blank">Cmdist@ccrma.stanford.edu</a><br>
&gt;&gt; <a href="https://cm-mail.stanford.edu/mailman/listinfo/cmdist" rel="noreferrer" target="_blank">https://cm-mail.stanford.edu/mailman/listinfo/cmdist</a><br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Cmdist mailing list<br>
&gt; <a href="mailto:Cmdist@ccrma.stanford.edu" target="_blank">Cmdist@ccrma.stanford.edu</a><br>
&gt; <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>