From 8cfffbeccdab028f780dcaf9f4ffaf97d7393a1e Mon Sep 17 00:00:00 2001 From: Daniel Cerqueira Date: Sun, 16 Aug 2026 12:59:14 +0100 Subject: add diff operator - and remove and diff and differ - and update documentation - and update all lali scripts --- examples/abacus/reading.lali | 62 ++++++++++++++++++------------------ examples/abacus/writing.lali | 62 ++++++++++++++++++------------------ examples/hanoi.lali | 2 +- examples/mandelbrot.lali | 2 +- examples/speech/en-random.lali | 12 +++---- examples/speech/en-random_more.lali | 12 +++---- examples/speech/pt-fixed_answer.lali | 12 +++---- examples/speech/pt-identify.lali | 4 +-- examples/speech/pt-random.lali | 12 +++---- examples/speech/pt-random_more.lali | 12 +++---- 10 files changed, 96 insertions(+), 96 deletions(-) (limited to 'examples') diff --git a/examples/abacus/reading.lali b/examples/abacus/reading.lali index 6663bb3..2f34f00 100755 --- a/examples/abacus/reading.lali +++ b/examples/abacus/reading.lali @@ -4,47 +4,47 @@ ;; functions (defun random-number (cases) (fill - ((dif cases +0) (cons (random +9) ())) + ((diff cases +0) (cons (random +9) ())) (f (cons (random +9) (random-number (- cases +1)))))) (defun number-to-symbol (num) (fill - ((dif +0 num) '0) - ((dif +1 num) '1) - ((dif +2 num) '2) - ((dif +3 num) '3) - ((dif +4 num) '4) - ((dif +5 num) '5) - ((dif +6 num) '6) - ((dif +7 num) '7) - ((dif +8 num) '8) - ((dif +9 num) '9))) + ((diff +0 num) '0) + ((diff +1 num) '1) + ((diff +2 num) '2) + ((diff +3 num) '3) + ((diff +4 num) '4) + ((diff +5 num) '5) + ((diff +6 num) '6) + ((diff +7 num) '7) + ((diff +8 num) '8) + ((diff +9 num) '9))) (defun number-to-earth-rod (num) (fill - ((dif +0 num) "[@-@][@@@@-@]") - ((dif +1 num) "[@-@][@@@-@@]") - ((dif +2 num) "[@-@][@@-@@@]") - ((dif +3 num) "[@-@][@-@@@@]") - ((dif +4 num) "[@-@][-@@@@@]") - ((dif +5 num) "[-@@][@@@@-@]") - ((dif +6 num) "[-@@][@@@-@@]") - ((dif +7 num) "[-@@][@@-@@@]") - ((dif +8 num) "[-@@][@-@@@@]") - ((dif +9 num) "[-@@][-@@@@@]"))) + ((diff +0 num) "[@-@][@@@@-@]") + ((diff +1 num) "[@-@][@@@-@@]") + ((diff +2 num) "[@-@][@@-@@@]") + ((diff +3 num) "[@-@][@-@@@@]") + ((diff +4 num) "[@-@][-@@@@@]") + ((diff +5 num) "[-@@][@@@@-@]") + ((diff +6 num) "[-@@][@@@-@@]") + ((diff +7 num) "[-@@][@@-@@@]") + ((diff +8 num) "[-@@][@-@@@@]") + ((diff +9 num) "[-@@][-@@@@@]"))) (defun number-to-air-rod (num) (fill - ((dif +0 num) "[@-@@@@][@-@]") - ((dif +1 num) "[@@-@@@][@-@]") - ((dif +2 num) "[@@@-@@][@-@]") - ((dif +3 num) "[@@@@-@][@-@]") - ((dif +4 num) "[@@@@@-][@-@]") - ((dif +5 num) "[@-@@@@][@@-]") - ((dif +6 num) "[@@-@@@][@@-]") - ((dif +7 num) "[@@@-@@][@@-]") - ((dif +8 num) "[@@@@-@][@@-]") - ((dif +9 num) "[@@@@@-][@@-]"))) + ((diff +0 num) "[@-@@@@][@-@]") + ((diff +1 num) "[@@-@@@][@-@]") + ((diff +2 num) "[@@@-@@][@-@]") + ((diff +3 num) "[@@@@-@][@-@]") + ((diff +4 num) "[@@@@@-][@-@]") + ((diff +5 num) "[@-@@@@][@@-]") + ((diff +6 num) "[@@-@@@][@@-]") + ((diff +7 num) "[@@@-@@][@@-]") + ((diff +8 num) "[@@@@-@][@@-]") + ((diff +9 num) "[@@@@@-][@@-]"))) ;; main (defun main () diff --git a/examples/abacus/writing.lali b/examples/abacus/writing.lali index 17fd7c4..4876582 100755 --- a/examples/abacus/writing.lali +++ b/examples/abacus/writing.lali @@ -4,47 +4,47 @@ ;; functions (defun random-number (cases) (fill - ((dif cases +0) (cons (random +9) ())) + ((diff cases +0) (cons (random +9) ())) (f (cons (random +9) (random-number (- cases +1)))))) (defun number-to-symbol (num) (fill - ((dif +0 num) '0) - ((dif +1 num) '1) - ((dif +2 num) '2) - ((dif +3 num) '3) - ((dif +4 num) '4) - ((dif +5 num) '5) - ((dif +6 num) '6) - ((dif +7 num) '7) - ((dif +8 num) '8) - ((dif +9 num) '9))) + ((diff +0 num) '0) + ((diff +1 num) '1) + ((diff +2 num) '2) + ((diff +3 num) '3) + ((diff +4 num) '4) + ((diff +5 num) '5) + ((diff +6 num) '6) + ((diff +7 num) '7) + ((diff +8 num) '8) + ((diff +9 num) '9))) (defun number-to-earth-rod (num) (fill - ((dif +0 num) "[@-@][@@@@-@]") - ((dif +1 num) "[@-@][@@@-@@]") - ((dif +2 num) "[@-@][@@-@@@]") - ((dif +3 num) "[@-@][@-@@@@]") - ((dif +4 num) "[@-@][-@@@@@]") - ((dif +5 num) "[-@@][@@@@-@]") - ((dif +6 num) "[-@@][@@@-@@]") - ((dif +7 num) "[-@@][@@-@@@]") - ((dif +8 num) "[-@@][@-@@@@]") - ((dif +9 num) "[-@@][-@@@@@]"))) + ((diff +0 num) "[@-@][@@@@-@]") + ((diff +1 num) "[@-@][@@@-@@]") + ((diff +2 num) "[@-@][@@-@@@]") + ((diff +3 num) "[@-@][@-@@@@]") + ((diff +4 num) "[@-@][-@@@@@]") + ((diff +5 num) "[-@@][@@@@-@]") + ((diff +6 num) "[-@@][@@@-@@]") + ((diff +7 num) "[-@@][@@-@@@]") + ((diff +8 num) "[-@@][@-@@@@]") + ((diff +9 num) "[-@@][-@@@@@]"))) (defun number-to-air-rod (num) (fill - ((dif +0 num) "[@-@@@@][@-@]") - ((dif +1 num) "[@@-@@@][@-@]") - ((dif +2 num) "[@@@-@@][@-@]") - ((dif +3 num) "[@@@@-@][@-@]") - ((dif +4 num) "[@@@@@-][@-@]") - ((dif +5 num) "[@-@@@@][@@-]") - ((dif +6 num) "[@@-@@@][@@-]") - ((dif +7 num) "[@@@-@@][@@-]") - ((dif +8 num) "[@@@@-@][@@-]") - ((dif +9 num) "[@@@@@-][@@-]"))) + ((diff +0 num) "[@-@@@@][@-@]") + ((diff +1 num) "[@@-@@@][@-@]") + ((diff +2 num) "[@@@-@@][@-@]") + ((diff +3 num) "[@@@@-@][@-@]") + ((diff +4 num) "[@@@@@-][@-@]") + ((diff +5 num) "[@-@@@@][@@-]") + ((diff +6 num) "[@@-@@@][@@-]") + ((diff +7 num) "[@@@-@@][@@-]") + ((diff +8 num) "[@@@@-@][@@-]") + ((diff +9 num) "[@@@@@-][@@-]"))) ;; main (defun main () diff --git a/examples/hanoi.lali b/examples/hanoi.lali index 59e3d10..786633c 100644 --- a/examples/hanoi.lali +++ b/examples/hanoi.lali @@ -7,7 +7,7 @@ (newline)) (defun hanoi-move (num from to via) - (fill ((dif num +1) + (fill ((diff num +1) (hanoi-print num from to)) (f (prog diff --git a/examples/mandelbrot.lali b/examples/mandelbrot.lali index c07b07d..0268deb 100644 --- a/examples/mandelbrot.lali +++ b/examples/mandelbrot.lali @@ -6,7 +6,7 @@ "2" "3" "4" "5" "6" "7" "8" "9" "%" "*" "&" "$" "@" "#")) (defun mandelbrot-iter (x y x0 y0 i) - (fill ((dif i +28) " ") + (fill ((diff 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) diff --git a/examples/speech/en-random.lali b/examples/speech/en-random.lali index 9ac271d..9deb0b0 100755 --- a/examples/speech/en-random.lali +++ b/examples/speech/en-random.lali @@ -23,13 +23,13 @@ (defun assoc (el lst) (fill - ((dif el (car (car lst))) (car lst)) + ((diff el (car (car lst))) (car lst)) ((algo lst) '(f f)) (f (assoc el (cdr lst))))) (defun without (el lst) (fill - ((dif el (car lst)) f) + ((diff el (car lst)) f) ((algo (car lst)) t) (f (without el (cdr lst))))) @@ -76,7 +76,7 @@ (set 'question-score target-question) (set 'my-words (readl)) - (differ my-words '(f)) + (diff my-words '(f)) (set 'answer-score (get-answer-score (map (lambda (word) @@ -85,7 +85,7 @@ (princ "\n~") (newline) (fill - ((dif target-answer + ((diff target-answer (+ question-score answer-score)) 'correct) (f 'wrong)))) @@ -93,8 +93,8 @@ (defun loop () (set 'res (main)) (fill - ((dif res 'correct) (loop)) - ((dif res 'wrong) (prog (princ ">> wrong") (newline))) + ((diff res 'correct) (loop)) + ((diff res 'wrong) (prog (princ ">> wrong") (newline))) (f f))) diff --git a/examples/speech/en-random_more.lali b/examples/speech/en-random_more.lali index fd94c6e..63c63c2 100755 --- a/examples/speech/en-random_more.lali +++ b/examples/speech/en-random_more.lali @@ -37,13 +37,13 @@ (defun assoc (el lst) (fill - ((dif el (car (car lst))) (car lst)) + ((diff el (car (car lst))) (car lst)) ((algo lst) '(f f)) (f (assoc el (cdr lst))))) (defun without (el lst) (fill - ((dif el (car lst)) f) + ((diff el (car lst)) f) ((algo (car lst)) t) (f (without el (cdr lst))))) @@ -102,7 +102,7 @@ (set 'question-score target-question) (set 'my-words (readl)) - (differ my-words '(f)) + (diff my-words '(f)) (set 'answer-score (get-answer-score (map (lambda (word) @@ -111,7 +111,7 @@ (princ "\n~") (newline) (fill - ((dif target-answer + ((diff target-answer (+ question-score answer-score)) 'correct) (f 'wrong)))) @@ -119,8 +119,8 @@ (defun loop () (set 'res (main)) (fill - ((dif res 'correct) (loop)) - ((dif res 'wrong) (prog (princ ">> wrong") (newline))) + ((diff res 'correct) (loop)) + ((diff res 'wrong) (prog (princ ">> wrong") (newline))) (f f))) diff --git a/examples/speech/pt-fixed_answer.lali b/examples/speech/pt-fixed_answer.lali index 0002672..b500975 100755 --- a/examples/speech/pt-fixed_answer.lali +++ b/examples/speech/pt-fixed_answer.lali @@ -18,13 +18,13 @@ (defun assoc (el lst) (fill - ((dif el (car (car lst))) (car lst)) + ((diff el (car (car lst))) (car lst)) ((algo lst) '(f f)) (f (assoc el (cdr lst))))) (defun without (el lst) (fill - ((dif el (car lst)) f) + ((diff el (car lst)) f) ((algo (car lst)) t) (f (without el (cdr lst))))) @@ -72,14 +72,14 @@ (set 'question-score target-question) (set 'my-reply (readl)) - (differ my-reply '(f)) + (diff my-reply '(f)) (set 'answer-score (get-answer-score (map (lambda (word) (car (cdr (assoc word reply)))) my-reply))) (fill - ((dif target-answer + ((diff target-answer (+ question-score answer-score)) 'correct) (f 'wrong)))) @@ -87,8 +87,8 @@ (defun loop () (set 'res (main)) (fill - ((dif res 'correct) (loop)) - ((dif res 'wrong) (prog (princ ">> errado") (newline))) + ((diff res 'correct) (loop)) + ((diff res 'wrong) (prog (princ ">> errado") (newline))) (f f))) (loop) diff --git a/examples/speech/pt-identify.lali b/examples/speech/pt-identify.lali index bef74ef..7dd69b6 100755 --- a/examples/speech/pt-identify.lali +++ b/examples/speech/pt-identify.lali @@ -12,7 +12,7 @@ (defun assoc (number lst) (fill - ((dif number (car (car lst))) (car lst)) + ((diff number (car (car lst))) (car lst)) ((algo lst) f) (f (assoc number (cdr lst))))) @@ -35,7 +35,7 @@ (set 'it-quest (assoc target-question question)) (princ (car (cdr it-quest))) (princ "\b?") - (not (dif (read) (car (cdr (cdr it-quest))))))) + (not (diff (read) (car (cdr (cdr it-quest))))))) (defun loop () (fill diff --git a/examples/speech/pt-random.lali b/examples/speech/pt-random.lali index e038f68..5454dc1 100755 --- a/examples/speech/pt-random.lali +++ b/examples/speech/pt-random.lali @@ -25,13 +25,13 @@ (defun assoc (el lst) (fill - ((dif el (car (car lst))) (car lst)) + ((diff el (car (car lst))) (car lst)) ((algo lst) '(f f f)) (f (assoc el (cdr lst))))) (defun without (el lst) (fill - ((dif el (car lst)) f) + ((diff el (car lst)) f) ((algo (car lst)) t) (f (without el (cdr lst))))) @@ -83,7 +83,7 @@ (set 'question-score target-question) (set 'my-words (readl)) - (differ my-words '(f)) + (diff my-words '(f)) (set 'answer-score (get-answer-score (map (lambda (word) @@ -92,7 +92,7 @@ (princ "\n~") (newline) (fill - ((dif target-answer + ((diff target-answer (+ question-score answer-score)) 'correct) (f 'wrong)))) @@ -100,8 +100,8 @@ (defun loop () (set 'res (main)) (fill - ((dif res 'correct) (loop)) - ((dif res 'wrong) (prog (princ ">> errado") (newline))) + ((diff res 'correct) (loop)) + ((diff res 'wrong) (prog (princ ">> errado") (newline))) (f f))) diff --git a/examples/speech/pt-random_more.lali b/examples/speech/pt-random_more.lali index 0c91c2c..94cd41c 100755 --- a/examples/speech/pt-random_more.lali +++ b/examples/speech/pt-random_more.lali @@ -37,13 +37,13 @@ (defun assoc (el lst) (fill - ((dif el (car (car lst))) (car lst)) + ((diff el (car (car lst))) (car lst)) ((algo lst) '(f f)) (f (assoc el (cdr lst))))) (defun without (el lst) (fill - ((dif el (car lst)) f) + ((diff el (car lst)) f) ((algo (car lst)) t) (f (without el (cdr lst))))) @@ -102,7 +102,7 @@ (set 'question-score target-question) (set 'my-words (readl)) - (differ my-words '(f)) + (diff my-words '(f)) (set 'answer-score (get-answer-score (map (lambda (word) @@ -111,7 +111,7 @@ (princ "\n~") (newline) (fill - ((dif target-answer + ((diff target-answer (+ question-score answer-score)) 'correct) (f 'wrong)))) @@ -119,8 +119,8 @@ (defun loop () (set 'res (main)) (fill - ((dif res 'correct) (loop)) - ((dif res 'wrong) (prog (princ ">> errado") (newline))) + ((diff res 'correct) (loop)) + ((diff res 'wrong) (prog (princ ">> errado") (newline))) (f f))) -- cgit