I suppose there is no progn

Q&A's, tips, howto's
Locked
shercipher
Posts: 15
Joined: Sun May 10, 2009 3:11 am

I suppose there is no progn

Post by shercipher »

For expressions that need to be evaluated sequentially in newLisp, there is no progn special form that says "evaluate these and return the last".

So how do I make code like this valid?

Code: Select all

(if (expr)
 ((eval 1) (eval 2) (eval3))
 (eval4))
It seems to execute the forms correctly, except that at the end of executing the forms it says "ERR: value expected: (whatever the last form was)"

HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Post by HPW »

Use 'begin' instead.

Or somewhere:

Code: Select all

(setq progn begin)
(constant(global 'progn))
Then you have 'progn'
Hans-Peter

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

In the manual:

http://www.newlisp.org/newlisp_manual.html#begin

In the Code Patterns document in the "Blocks" section:

http://www.newlisp.org/CodePatterns.html#flow

Locked