From f6222363b1600f224f7ab763f4b474148b958469 Mon Sep 17 00:00:00 2001 From: Folkert Kevelam Date: Sun, 23 Mar 2025 21:37:05 +0100 Subject: [PATCH] Initial commit --- SICP/exercise_1_12.janet | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 SICP/exercise_1_12.janet diff --git a/SICP/exercise_1_12.janet b/SICP/exercise_1_12.janet new file mode 100644 index 0000000..de18382 --- /dev/null +++ b/SICP/exercise_1_12.janet @@ -0,0 +1,21 @@ + +(defn pascal [x y] + (cond + (<= x 0) 0 + (> x y) 0 + (<= y 1) 1 + (+ (pascal (- x 1) (- y 1)) (pascal x (- y 1))))) + +(def max_val 15) +(var x 1) +(var y 0) +(while (< y max_val) + (cond + (> x y) (do + (set x 1) + (set y (+ y 1)) + (print "") + (prin (string/repeat " " (- max_val y)))) + (do + (prin (string/format " %d" (pascal x y))) + (set x (+ x 1)))))