Skip to content

Instantly share code, notes, and snippets.

@Anderssorby
Created July 5, 2016 19:30
Show Gist options
  • Save Anderssorby/5d42587f12d09a25913f5ad891059009 to your computer and use it in GitHub Desktop.
Save Anderssorby/5d42587f12d09a25913f5ad891059009 to your computer and use it in GitHub Desktop.
;; 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