let and letn

Q&A's, tips, howto's

let and letn

Postby newBert » Mon Mar 04, 2019 1:30 pm

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))
BertrandnewLISP v.10.7.5 64-bit on Linux (Peppermint 9)
newBert
 
Posts: 137
Joined: Fri Oct 28, 2005 5:33 pm
Location: France

Re: let and letn

Postby ralph.ronnquist » Tue Mar 05, 2019 8:17 am

Hmm. I get
Code: Select all
(1 2 3 (4 5 6 7) (nil nil nil nil))
as I would expect.
ralph.ronnquist
 
Posts: 202
Joined: Mon Jun 02, 2014 1:40 am
Location: Melbourne, Australia

Re: let and letn

Postby cameyo » Tue Mar 05, 2019 11:27 am

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
cameyo
 
Posts: 59
Joined: Sun Mar 27, 2011 3:07 pm

Re: let and letn

Postby rickyboy » Tue Mar 05, 2019 3:44 pm

I think newBert just had a polluted outer environment. newBert, try running that code with a freshly started newlisp.
(λx. x x) (λx. x x)
rickyboy
 
Posts: 582
Joined: Fri Apr 08, 2005 7:13 pm
Location: Front Royal, Virginia

Re: let and letn [resolved]

Postby newBert » Thu Mar 07, 2019 5:33 pm

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.
BertrandnewLISP v.10.7.5 64-bit on Linux (Peppermint 9)
newBert
 
Posts: 137
Joined: Fri Oct 28, 2005 5:33 pm
Location: France


Return to newLISP in the real world

Who is online

Users browsing this forum: No registered users and 0 guests

cron