[CM] Learn Scheme For Max with S7 e-book up

Iain Duncan iainduncanlists at gmail.com
Wed Mar 24 13:15:08 PDT 2021


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!

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!

iain

On Wed, Mar 24, 2021 at 12:52 PM Christos Vagias <chris.actondev at gmail.com>
wrote:

> Congratulations Iain! Amazing work!
>
> By taking a quick look I also learned something! Didn't know that map
> can operate on more than one list
> (or more generally, more than one iteratables). Quite the
> embarrassment having worked quite some time
> with scheme/clojure. That makes writing sth like map-indexed
> (a-la-clojure) really trivial (and unnecessary).
>
> Would like to share some snippets, you might find them interesting.
> Also, they touch the "iterator" concept in s7,
> which is worth mentioning.
>
> (define* (lazy-range (n +inf.0) (start 0) (step 1))
>   (let ((+iterator+ #t)
>         (i start)
>         (counter 0))
>     (lambda ()
>       (let ((res i))
>         (if (= counter n)
>             #<eof>
>             (begin
>               (set! i (+ step i))
>               (set! counter (+ 1 counter))
>               res))))))
>
> (is equivalent? '(0 1 2) (map values (lazy-range 3)))
>
> (test "lazy range: can be used for map-indexed "
>       (is equivalent? '(a 0 b 1)
>           (map (lambda  (x y)
>                  (values x y))
>                '(a b)
>                (lazy-range)))
>       (is equivalent? '(0 a 1 b)
>           (map (lambda  (x y)
>                  (values x y))
>                (lazy-range)
>                '(a b))))
>
> And some more clojure-inspired bits
>
> (define (take n lazy-seq)
>   (map (lambda (_ x)  x)
>        (range n)
>        lazy-seq))
>
> (test "take x from lazy-seq"
>       (define seq (lazy-range 8))
>       (is equivalent? '(0 1 2) (take 3 seq))
>       (is equivalent? '(3 4 5) (take 3 seq))
>       (is equivalent? '(6 7) (take 3 seq)))
>
>
> Also, a small suggestion (wrt the map list.. (length fruits) that you
> have in the book),
> would be to comment against calling length on lists.
> This causes traversing the whole (linked) list to find the length.In
> vectors
> though it'd be fine.
>
>
> On Tue, 23 Mar 2021 at 17:20, Iain Duncan <iainduncanlists at gmail.com>
> wrote:
> >
> > Thanks, it could very well be helpful! When I first started the hunt I
> was only looking at Max resources so never found that.
> >
> > thanks Forrest.
> > iain
> >
> > On Tue, Mar 23, 2021 at 9:12 AM Forrest Curo <treegestalt at gmail.com>
> wrote:
> >>
> >> Is this useful? --  https://github.com/etienne-p/Pd_Scheme
> >>
> >> On Mon, Mar 22, 2021 at 9:39 PM Iain Duncan <iainduncanlists at gmail.com>
> wrote:
> >>>
> >>> 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.
> >>>
> >>> iain
> >>>
> >>> On Mon, Mar 22, 2021 at 8:37 PM Forrest Curo <treegestalt at gmail.com>
> wrote:
> >>>>
> >>>> Is this applicable to Pure Data?
> >>>>
> >>>> I see that there are a few references to a pd-scheme object; I don't
> know how well that works(?)
> >>>>
> >>>> On Mon, Mar 22, 2021 at 6:42 PM Iain Duncan <
> iainduncanlists at gmail.com> wrote:
> >>>>>
> >>>>> 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.
> >>>>>
> >>>>> Book:
> >>>>> https://iainctduncan.github.io/learn-scheme-for-max/
> >>>>>
> >>>>> File issues for feedback here:
> >>>>> https://github.com/iainctduncan/learn-scheme-for-max
> >>>>>
> >>>>> Thanks!
> >>>>> iain
> >>>>> _______________________________________________
> >>>>> Cmdist mailing list
> >>>>> Cmdist at ccrma.stanford.edu
> >>>>> https://cm-mail.stanford.edu/mailman/listinfo/cmdist
> >>
> >> _______________________________________________
> >> Cmdist mailing list
> >> Cmdist at ccrma.stanford.edu
> >> https://cm-mail.stanford.edu/mailman/listinfo/cmdist
> >
> > _______________________________________________
> > Cmdist mailing list
> > Cmdist at ccrma.stanford.edu
> > https://cm-mail.stanford.edu/mailman/listinfo/cmdist
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cm-mail.stanford.edu/pipermail/cmdist/attachments/20210324/e3ed6f0d/attachment.html>


More information about the Cmdist mailing list