+
1
|
list
|
skin
|
login
|
editor
α-wwwiki
::
lisp
user:none
(2832 bytes)
{div {@ style="float:left;margin:20px;"}{show {@ src="data/lisp-glossy.jpg" height="200" width="600" title="LISP LOGO"}}} _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); } Or in a shorter way : {define fac(n) return (n< 1)? 1 : n*arguments.callee(n-1) } {fac 6} °°} _p See also pages [[define]], [[defun]], [[lambda]], [[lisp_evaluator]] and others like [[recursion]]. _p The question is « Which is the best in a wiki context ? » _h3 links _ul [[Homoiconicity|http://en.wikipedia.org/wiki/Homoiconicity]] _ul [[lml.b9.com/|http://lml.b9.com/]] _ul [[deptinfo.unice.fr/~roy/|http://deptinfo.unice.fr/~roy/]] _ul [[Christian Queinnec|http://pagesperso-systeme.lip6.fr/Christian.Queinnec/WWW/Queinnec.html]] _ul [[newlisp|http://www.newlisp.org/]] _ul [[michaelnielsen.org : lisp-as-the-maxwells-equations-of-software/|http://www.michaelnielsen.org/ddi/lisp-as-the-maxwells-equations-of-software/]] _ul [[http://www.dmitrynizh.com/lisp.html|http://www.dmitrynizh.com/lisp.html]] _ul [[http://www.jslisp.org/|http://www.jslisp.org/]] _ul [[https://github.com/jbr/sibilant|https://github.com/jbr/sibilant]] _ul [[How to design programs|http://www.htdp.org/]] _ul [[ExpressionEvaluation|http://www.newlisp.org/ExpressionEvaluation.html]] _ul [[jeffshrager.org/llisp|http://jeffshrager.org/llisp/]] _ul [[c2.com/cgi/wiki?EvalApply|http://c2.com/cgi/wiki?EvalApply]] _ul [[c2.com/cgi/wiki?WhyLisp|http://c2.com/cgi/wiki?WhyLisp]]