Changeset 37103 in project


Ignore:
Timestamp:
01/20/19 23:23:23 (4 weeks ago)
Author:
svnwiki
Message:

Anonymous wiki edit for IP [220.233.44.123]: Added more example Shen code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/5/shen

    r37102 r37103  
    2323
    2424=== Example Shen Code
     25
     26==== Basic List processing
     27
     28<enscript highlight="lisp">
     29(define factorial
     30        0 -> 1
     31        X -> (* X (factorial (- X 1))))
     32</enscript>
     33
     34<enscript highlight="lisp">
     35(define total
     36        [] -> 0
     37        [X | Y] -> (+ X (total Y)))
     38</enscript>
     39
     40
     41<enscript highlight="lisp">
     42(define triples
     43        [] -> []
     44        [W X Y | Z] -> [[W X Y] | (triples Z)])
     45</enscript>
    2546
    2647==== YACC
Note: See TracChangeset for help on using the changeset viewer.