Mercurial > rlm
view src/rlm/elisp_example.el @ 5:fca75c0e8f40
added stories.clj
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Thu, 01 Mar 2012 05:47:37 -0700 |
parents | 78a630e650d2 |
children |
line wrap: on
line source
2 ;;No BigNum Promotion3 (defun factorial (n &optional f)4 (cond ((null f) (factorial n 1))5 ((<= n 1) f)6 (t (factorial (- n 1) (* n f)))))8 ;; No Tail Recursion9 (defun count (n &optional work)10 (cond ((<= n 0) work)11 (t (count (- n 1) (cons n work)))))13 ;;Shallow Dynamic Variables by Default14 (setq x 3)16 (defun whatisx ()17 x)19 (defun frobx ()20 (setq x 5)21 (whatisx))23 (defun mungex (x)24 (whatisx))26 (defun duncant ()27 (print n))29 (defun rlm (n)30 (duncant))32 ;; no namespaces :(34 ;; compiles to bytecode, very small memory footprint36 ;; LISP 237 (reduce + '(1 2 3 4)) ;;doesn't work38 (reduce (function +) '(1 2 3 4)) ;;have to do this!39 (reduce #'+ '(1 2 3 4)) ;;this works too...