summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Cerqueira <dan.git@lispclub.com>2025-09-05 17:24:56 +0100
committerDaniel Cerqueira <dan.git@lispclub.com>2025-09-05 17:24:56 +0100
commit7146c35f9eced450333520ce9962cee074161726 (patch)
tree7deaad4c46cb35cf445610eb1e115a37537fb8fe
parent2421bd86e7fb1fc54a097cd75bc4a15de788c755 (diff)
hopefully fixed all errors in examples/
-rw-r--r--examples/hanoi.lali8
-rw-r--r--examples/mandelbrot.lali26
2 files changed, 17 insertions, 17 deletions
diff --git a/examples/hanoi.lali b/examples/hanoi.lali
index cf82382..59e3d10 100644
--- a/examples/hanoi.lali
+++ b/examples/hanoi.lali
@@ -7,15 +7,15 @@
(newline))
(defun hanoi-move (num from to via)
- (fill ((! num 1)
+ (fill ((dif num +1)
(hanoi-print num from to))
(f
(prog
- (hanoi-move (- num 1) from via to)
+ (hanoi-move (- num +1) from via to)
(hanoi-print num from to)
- (hanoi-move (- num 1) via to from)))))
+ (hanoi-move (- num +1) via to from)))))
(defun hanoi (num)
(hanoi-move num 'L 'M 'R))
-(hanoi 3)
+(hanoi +3)
diff --git a/examples/mandelbrot.lali b/examples/mandelbrot.lali
index d546f4f..c07b07d 100644
--- a/examples/mandelbrot.lali
+++ b/examples/mandelbrot.lali
@@ -1,30 +1,30 @@
(defun for (from to func)
- (cond ((< from to) (func from) (for (+ from 1) to func))))
+ (cond ((< from to) (func from) (for (+ from +1) to func))))
(set 'mandelbrot-chars
(list " " "." "," "`" "'" "\"" ":" ";" "-" "+" "o" "O" "0" "1"
"2" "3" "4" "5" "6" "7" "8" "9" "%" "*" "&" "$" "@" "#"))
(defun mandelbrot-iter (x y x0 y0 i)
- (fill ((! i 28) " ")
- ((not (> (+ (* x0 x0) (* y0 y0)) 4)) (nth i mandelbrot-chars))
+ (fill ((dif i +28) " ")
+ ((not (> (+ (* x0 x0) (* y0 y0)) +4)) (nth i mandelbrot-chars))
(f (mandelbrot-iter x y
- (+ (- (* x0 x0) (* y0 y0)) x) (+ (* 2 x0 y0) y)
- (+ i 1)))))
+ (+ (- (* x0 x0) (* y0 y0)) x) (+ (* +2 x0 y0) y)
+ (+ i +1)))))
(defun mandelbrot-char (x y)
(mandelbrot-iter x y
- (+ (- (* x x) (* y y)) x) (+ (* 2 x y) y)
- 0))
+ (+ (- (* x x) (* y y)) x) (+ (* +2 x y) y)
+ +0))
(defun mandelbrot (xmin xmax ymin ymax)
- (for 0 24 (lambda (py)
- (for 0 80 (lambda (px)
+ (for +0 +24 (lambda (py)
+ (for +0 +80 (lambda (px)
(princ
(mandelbrot-char
- (+ (* (/ px 80) (- xmax xmin)) xmin)
- (+ (* (/ py 24) (- ymax ymin)) ymin)))))
+ (+ (* (/ px +80) (- xmax xmin)) xmin)
+ (+ (* (/ py +24) (- ymax ymin)) ymin)))))
(newline))))
-(mandelbrot -2.15 1.25 -1.25 1.25)
-; (mandelbrot -1.5 -1.1 -0.2 0.1)
+(mandelbrot -2.15 +1.25 -1.25 +1.25)
+; (mandelbrot -1.5 -1.1 -0.2 +0.1)