IRC channel logs

2024-12-26.log

back to list of logs

<lechner>dsmith / okay, thanks!
<lechner>that leaves me with my macro. would someone please offer their help to expand this macro to multiple variables? thanks! https://bpa.st/PPTQ
<dsmith>sneek, macros?
<sneek>Last time I checked macros is http://hipster.home.xs4all.nl/lib/scheme/gauche/define-syntax-primer.txt
<mwette>(define-syntax-rule (wpv (var ...) exp ...) ((lambda (var ...) exp ...) var ...))
<lechner>dsmith / thanks! I tried to read that two weeks ago---although under a different link, i think---and will try again
<mwette>lecnher: ^ (wpv == with-preserved-values) should work, I think
<mwette>Oh, unless some of those are globals access from body via indirect calls. So, maybe not.
<dsmith>I think some recursion will need to be involved.. One level for each variable remember.
<dsmith>to rememebr
<dsmith>This is basically an attempt at dynamic scoping?
<mwette>let => one lambda; let* => one lambda per var
<mwette>This core lisp. https://www.youtube.com/watch?v=OyfBQmvr2Hc
<lechner>dsmith / mwette / i did this one without recursion https://bpa.st/WAEA
<lechner>with dpk's help (thank you!)
<lechner>okay, I forgot I can use a dotted tail like (variable . more-variables) which will make recursion easier
<dsmith>lechner, I was thinking something like this: https://bpa.st/5Y4Q
<dsmith>Of course, naming things is hard
<dsmith>lechner, Or if you want it to return a value of the last exp in body: https://bpa.st/BVEQ
<lechner>dsmith / thanks! i was thinking about something like the second one. pursuant to your recommendation, i'm reading a bunch about macros. why is "(arg arg* ...)" superior to "(arg .args)" please?
<dsmith>I don't know. Just fits my mental model better? If in your pattern you have "(k v) ..." then in your template you can have "k ..." and "v ..." Can you do that with a dotted tail?
<dsmith>As in a let being transformed into a lambda, for example.
<dsmith>(let ((binding value) ...) body body* ...) -> ((lambda (binding ...) body body* ...) value ...) (I think I got that right)
<dsmith>The common wisdom is to avoid a macro if a lambda will do.
<dsmith>ISTR something about performance and preferring ". tail" over "..."
<ArneBab>sneek: later tell apteryx: I mean the email "23.12.2024 Fp Maxim … LRe: bug#71300: [PATCH v3] doc: Document SRFI 64."
<sneek>Will do.