22 lines
425 B
Plaintext
22 lines
425 B
Plaintext
|
|
(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)))))
|