This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn next-row [row] | |
(let [inner-section (mapv #(+ %1 %2) (butlast row) (rest row))] | |
(cons 1 (conj inner-section 1)))) | |
(defn pascal | |
"row-count is the number of rows including the single '1' | |
at the top." | |
([row-count] | |
(pascal row-count identity)) | |
([row-count print-fn] |