> My question: which mechanism frees X of the value it was setq-ed?
During function execution, the variables (symbols actually) used as parameters
(in the function definition) are like in an implicit (let):
When executing, the values are bound to the arguments as specified in the
function call,
On Mon, Oct 16, 2017 at 03:44:54PM +0200, Christophe Gragnic wrote:
> Because I thought that setq would store a value in the parameter var
> "more permanently".
> Something like:
>
> : (foo (need 3))
>(need 3)
>-> 3
> : X
> -> (need 3) # what I expected
>
> I thought using a let w
On Mon, Oct 16, 2017 at 3:25 PM, Alexander Burger wrote:
> This is just unnecessary overhead, as 'let' is basically 'bind' (or 'use' to
> be
> more correct) plus 'setq'. And 'X' is bound already by the function call. So
> why
> waste time and (stack)space?
Because I thought that setq would stor
Hi Christophe,
> I'm quite surprised of the use of setq instead of let.
> Could you please elaborate?
Do you mean, staying with the generated example code:
(de foo X
(setq X (car X))
(msg X)
(length (eval X)) )
to generate instead:
(de foo X
(let X (car X)
On Sat, Oct 14, 2017 at 7:48 AM, Alexander Burger wrote:
> You are close :)
Hi Alex,
Thanks, I'm making some progress at last!
A personal lesson:
when meta-programming, I should make more use of pp.
> I would do this:
>
>(de decar Lst
> (def (++ Lst)
> (let Var (++ Lst)
>
On Sat, 14 Oct 2017 07:48 +0200, Alexander Burger wrote:
> Test:
>
> [...]
>
>: (foo (need 3))
>(need 3)
>-> 3
Rounding off the test:
: (foo (need 3) 'this-and-subsequent-will-be-ignored 42 (/ 1 0))
(need 3)
-> 3
Of course. :)
--
UNSUBSCRIBE: mailto:picolisp@software
Hi Christophe,
> (decar myfn arg
> # here arg is the first arg given when calling myfn, unevaluated
> )
>
>
> This is my attempt:
>
> (de decar args
> (let (fn (car args)
> arg (cadr args)
> body (cddr args))
> (set fn (list (list "arg") (list 'let arg "arg" (list
Hi list! (ha ha, a list…)
Could someone provide me with a function which looks like 'de
but is not 'de itself. Let's call it 'decar.
With de:
(de myfn args
# here args is the list of the unevaluated args that were
# given when calling myfn
)
With decar:
(decar myfn arg
# here arg is the