Skip to content

Instantly share code, notes, and snippets.

@skuro
Last active August 29, 2015 14:03
Show Gist options
  • Select an option

  • Save skuro/a673f7d687998d1b21d7 to your computer and use it in GitHub Desktop.

Select an option

Save skuro/a673f7d687998d1b21d7 to your computer and use it in GitHub Desktop.
Solution for the problems in today's meetup
; https://www.hackerrank.com/challenges/functional-programming-warmups-in-recursion---fibonacci-numbers
(let [fibos (iterate (fn [[a0 a1]] [a1 (+ a0 a1)]) [0 1])
fibo (fn [n] (->> n dec (nth fibos) first))]
(->
(read)
fibo
println))
;https://www.hackerrank.com/challenges/pascals-triangle
(let [k (read)
funny (fn [v]
(apply println v)
(map + (concat [0] v) (concat v [0])))
_ (nth (iterate funny [1]) k)])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment