[CM] Let with list destructuring

Iain Duncan iainduncanlists at gmail.com
Thu Sep 10 07:35:19 PDT 2020


Nice, thanks for sharing this! I will certainly add it to my base S7 files
for scheme-for-max!

I have been meaning to port over Clojure's thread-first and thread-last
macros but haven't got to it yet as we are in the process of trying to buy
and sell a house and move. Which to the surprise of no one who's done it,
I'm sure, is vastly more time consuming than I expected. Ugh. :-/

thanks for sharing it
iain

On Thu, Sep 10, 2020 at 3:30 AM Christos Vagias <chris.actondev at gmail.com>
wrote:

> Hi all,
>
> Wanted to share with you a macro I wrote about let (and let*) with
> list destructuring. Something similar to the destructuring-bind as seen
> in stuff.scm
> I missed this functionality from clojure.
>
> Example usage:
>
> ;; letd: mnemonic: let-destructure
>  (letd ((a 1)
>         (b 2)
>         ((c d) (list (+ 1 2) 4)))
>        (list a b c d ))
>  ;; => (1 2 3 4)
>
> (letd* ((a 1)
>        (b 2)
>        ((c d) (list (+ 1 2) 4))
>        (e (+ 1 d)))
> (list a b c d e))
> ;; =>  ;; (1 2 3 4 5)
>
> Note: clojure also has destructuring for maps etc. Didn't have this need
> yet,
> but guess the macro could be modified to accommodate destructuring
> hashmaps, inlets etc.
>
> _______________________________________________
> 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/20200910/e8b479c9/attachment.html>


More information about the Cmdist mailing list