diff --git a/examples/animation.lisp b/examples/animation.lisp index 1a7d77a..e8ccf30 100644 --- a/examples/animation.lisp +++ b/examples/animation.lisp @@ -5,6 +5,6 @@ (def t (sin (div (time) 100))) (def pos (add 200 (mul 30 t))) -(def square (lambda (a) (rect (add 200 a) a a a))) +(defn square (a) (rect a a a a)) (stroke (square pos) 1 "red") ) \ No newline at end of file diff --git a/examples/dejong.lisp b/examples/dejong.lisp index 4576650..9d19d27 100644 --- a/examples/dejong.lisp +++ b/examples/dejong.lisp @@ -1,18 +1,19 @@ +; dejong attractor + ( (clear) - (def point (lambda (x y color) (stroke (circle x y 0.1) 1 color))) - (def _dejong (lambda (x y a b c d) + (defn point (x y color) (fill (circle x y 0.1) color)) + (defn _dejong (x y a b c d) (rest ((point - (add 700 (mul 100 x)) + (add 300 (mul 100 x)) (add 400 (mul 100 y)) - "rgba(255,0,0,1)") + "rgba(255,0,0,0.5)") (add (sin (mul a y)) (mul x (cos (mul b x)))) (add (mul x (sin (mul x c))) (cos (mul d y))) )) - )) + ) - - (def dejong (lambda (r a b c d) + (defn dejong (r a b c d) (reduce (lambda (acc val) (first ( @@ -21,6 +22,6 @@ (range 0 r) (2 1) ) - )) - (dejong 32000 1.4 -2.3 2.4 -2.1) + ) + (dejong 128000 1.4 -2.3 2.4 -2.1) ) diff --git a/examples/recursive.lisp b/examples/recursive.lisp index 08bd296..50a2c7c 100644 --- a/examples/recursive.lisp +++ b/examples/recursive.lisp @@ -1,15 +1,16 @@ +; recursive + ( (clear) - (def rec - (lambda (v) + (defn rec + (v) (if (gt v 0) - ( - (stroke (circle - (mul 5 v) - (mul 5 v) - (mul 5 v)) 1 "red") - (rec (sub v 5)) - ) - (echo "done")))) + ((stroke (circle + (mul 5 v) + (mul 5 v) + (mul 5 v)) 1 "red") + (rec (sub v 5)))) + ) + (rec 100) ) \ No newline at end of file