The nice thing about LISP and Scheme is, that the syntax rules are very simple : the first list member is the functor/operator and the rest are the parameters/arguments. The only difference between LISP and Scheme/newLISP is that Scheme and newLISP evaluate the first list member first before applying it to the parameters:Quote from: "Lutz"
Code Select
;; newLISP and Scheme evaluate the operator part first (other LISPs don't):
((if (> A B) + *) A B)
;; in this example A and B are added if A > B else multiplied
Most of Jeremy's suggestions could be implemented by defining functions or macros for it, i.e:
Code Select
(define (<=> x y A B C)
(if
(< x y) A
(= x y) B
(> x y) C))
(<=> 3 4 10 20 30) => 10
(<=> 4 4 10 20 30) => 20
(<=> 5 4 10 20 30) => 30
In newLISP you also have the possibility to redefine the built-in functions using 'constant'. Doing this and using functions and macros, you can completely tailor a language to your own taste, which is the reason people use these kind of languages in the first place, because they let you define your own language appropiate to the problem area you are developing in.
Lutz
Please forgive my poor AutoLISP addled brain, I am having to learn a new way to think here. Your example has a statement that in purest form is
(if a b c d e f). I thought an if statement can have only 3 arguments. I take it it keeps grabbing them and interprets it as (if a b (if c d (if e f)))? But I thought all the other functions left associate as in
(fn (fn (fn a b) c) d) is if an exception or am I just lost?