Page 1 of 1
let and letn
Posted: Mon Mar 04, 2019 1:30 pm
by newBert
I don't understand why
letn isn't required here, or why
let doesn't cause an error:
Code: Select all
(let (a 1 b 2 c 3 d '(4 5 6 7) e (flat (list a b c d)))
(println (list a b c d e)))
;−> (1 2 3 (4 5 6 7) (1 2 3 4 5 6 7))
Re: let and letn
Posted: Tue Mar 05, 2019 8:17 am
by ralph.ronnquist
Hmm. I get
Code: Select all
(1 2 3 (4 5 6 7) (nil nil nil nil))
as I would expect.
Re: let and letn
Posted: Tue Mar 05, 2019 11:27 am
by cameyo
I get:
Code: Select all
(1 2 3 (4 5 6 7) (nil nil nil nil))
with newLISP 10.7.5 and 10.7.4 on windows 10.
cameyo
Re: let and letn
Posted: Tue Mar 05, 2019 3:44 pm
by rickyboy
I think newBert just had a polluted outer environment. newBert, try running that code with a freshly started newlisp.
Re: let and letn [resolved]
Posted: Thu Mar 07, 2019 5:33 pm
by newBert
Indeed, I've just tried again now, in a new NewLISP session, and I get the expected result: (1 2 3 (4 5 6 7) (nil nil nil nil)). I'm reassured :). Thank you , RalphRonnquist, Cameyo and Rickyboy for your replies and advice.
I don't know what could have happened... I probably forgot NewLISP has no lexical scoping by default.