What are mdl and estack?
Posted: Tue May 26, 2009 10:31 am
These symbols are in (symbols) but I do not know their purpose.
Friends and Fans of newLISP
http://www.newlispfanclub.alh.net/forum/
http://www.newlispfanclub.alh.net/forum/viewtopic.php?f=2&t=2784
Code: Select all
(set (global 'module) (fn (mdl)
(load (append (env "NEWLISPDIR") "/modules/" mdl))))
; example
(module "mysql.lsp")
Code: Select all
(define (foo x y z)
(println "-> " (estack)) (bar x))
(define (bar x)
(println "->" (estack)) x)
(set 'x 1 'y 2 'z 3)
> (foo 11 22 33 44 55)
-> (($args ()) (z 3) (y 2) (x 1))
->(($args (44 55)) (x 11) ($args ()) (z 3) (y 2) (x 1))
11
>
Code: Select all
> (foo 11 22 33 44 55)
-> (($args ()) (z 3) (y 2) (x 1))
->(($args (44 55)) (x 11) ($args ()) (z 3) (y 2) (x 1))
11
>
But it could be fun!... This would only encourage to write unreadable hard to understand code.
Code: Select all
(set 'y 99 'z '( " bottles" " of beer on the wall" "no more" "Take one down and pass it around, "
"Go to the store and buy some more, " ".\n" ))
(set 'a (z 0) 'b (z 1) 'c (z 2) 'd (z 3) 'e (z 4) 'f (z 5) 'g (0 -1 a) 'h (0 8 b) 'i (-2 d))
(for (x y 0)
(println
(if (> x 0) x (title-case c)) (if (= x 1) g a) b i (if (= x 0) c x) (if (= x 1) g a) h f
(if (= x 0) e d) (case x (0 y) (1 c) (true (- x 1))) (if (= x 2) g a) b f ))