[CM] When does a let get created?
Iain Duncan
iainduncanlists at gmail.com
Fri Sep 24 07:36:57 PDT 2021
Don't know if this is helpful because I doubt this is new to you, but I
have done something like the below:
; returns inner let
(define (my-obj arg val)
(let ((arg val) (foo 'bar))
(curlet)))
In my use case it's bigger because I actually have objects that can return
their let on a specific message to allow monkey patching them from the repl.
On Fri, Sep 24, 2021 at 7:30 AM Woody Douglass <
wdouglass at carnegierobotics.com> wrote:
> I figured out that I can explicitly copy the current environment with
> inlet, so my function is now
>
> (define (make-info name location description) (inlet (curlet)))
>
> This works for my purposes, but is it idiomatically correct?
>
> Thanks,
> Woody
>
> On Fri, 2021-09-24 at 09:41 -0400, Woodrow Douglass wrote:
> > I'm trying to write a function that makes a simple dictionary of
> > informaton
> >
> > (define (make-info name location description) (curlet))
> >
> > but it seems that let gets reused or something -- the values seem to
> > change when the function gets called more then once
> >
> > i could just use associative lists by doing
> >
> > (define (make-info name location description) (let->list (curlet)))
> >
> > but i really like how lets work (applicable, etc...)
> > What assumption have i gotten wrong? why doesn't a new let get
> > created
> > per function call?
> >
> > Thanks,
> > Woody Douglass
>
> _______________________________________________
> 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/20210924/7ca43a83/attachment.html>
More information about the Cmdist
mailing list