return page history
α-wwwiki
::
history/lisp/20130713-075530.txt
editor : alpha [82.248.190.27] 2013/07/13 07:55:30 _h1 lisp _p The [[lambdaway project|../lambdaway_2.0/]] contains two lisp engines : _ul [[lambdalisp|../lambdaway_2.0/?view=lambdalisp]] which is a true Lisp mini dialect, _ul [[lambdatalk|../lambdaway_2.0/?view=lambdatalk]] which is built on a different engine (see [[parser]]) and which contains a very basic subset of Lisp, much more oriented for HTML treatments in the wiki. _p In alphawiki, lambdatalk{sup lite} doesn't try to mimic Lisp, and is nothing then a Javascript wrapper. Let's focus on the function define applied to the factorial : _h3 1) with lambdalisp _p Except brackets replacing parenthesis (to avoid conflicts with simple parenthesis used in the wiki text), it's pure lisp : {pre °° [define fac [lambda [n] [if [< n 1] 1 [* n [fac [-- n]]] ] ] ] [fac 6] °°} _h3 2) with lambdatalk _p In the previous version of lambdatalk, arguments must be prefixed by ":", the words "then" and "else" are added (for sugar) in the "if" operator : {pre °° {define fac (:n) (if (< :n 1) then 1 else (* :n (fac (-- :n))) ) } {fac 6} °°} _h3 3) with lambdatalk (in α-wiki) _p In α-wiki's reduced version of lambdatalk, the body is any Javascript expression : {pre °° {define fac (n) function rfac (n) { if (n< 1) return 1; else return n*rfac(n-1); } return rfac(n); } {fac 6} °°} _p See also pages [[define]], [[defun]], [[lambda]] and others like [[recursion]]. _p The question is « Which is the best in a wiki context ? » _h3 links _ul [[lml.b9.com/|http://lml.b9.com/]] _ul [[deptinfo.unice.fr/~roy/progfonc|http://deptinfo.unice.fr/~roy/progfonc.html]]