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)))))