Created
July 5, 2016 19:30
-
-
Save Anderssorby/5d42587f12d09a25913f5ad891059009 to your computer and use it in GitHub Desktop.
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
;; Creates the nth row of pascals triangle | |
;; the addition way | |
(fn [n] | |
(loop [s [1]] | |
(if | |
(= n (count s)) s | |
(recur (into (into [1] (map + s (rest s))) [1])) | |
))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment