myCompiler
English
Deutsch
English
Español
Français
Italiano
日本語
한국어
Nederlands
Polski
Português
Recent
Login
Sign up
Deutsch
English
Español
Français
Italiano
日本語
한국어
Nederlands
Polski
Português
Recent
Login
Sign up
G
@guillito
Joy Of Clojure Recursion
Clojure
4 years ago
; Your code here! (def simple-metric {:meter 1, :km 1000 :cm 1/100 :mm [1/10 :cm]}) #_(-> (* 3 (:km simple-metric)) (+ (* 10 (:meter simple-metric))) (+ (* 80 (:cm simple-metric)))
Week 2 - #26,29,48,42
Clojure
4 years ago
;;Fibonacci Sequence ;;# 26 ** ; This problem has to do with Fibonacci sequences. It is a series of integers where the next ; number is found by adding up the two numbers before it: ; 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144… ;Write a function which returns the first X Fibonacci numbers. ; (= (__ 3) '(1 1 2)) ; (= (__ 6) '(1 1 2 3 5 8)) ; (= (__ 8) '(1 1 2 3 5 8 13 21))
week #1 - 4CLJ DAY 5: #30,31,41,45,33
Clojure
4 years ago
; 30 - Write a function which removes consecutive duplicates from a sequence. ;; * * ; (= (apply str (__ "Leeeeeerrroyyy")) "Leroy") ; (= (__ [1 1 2 3 3 2 2 3]) '(1 2 3 2 3)) ; (= (__ [[1 2] [1 2] [3 4] [1 2]]) '([1 2] [3 4] [1 2])) #_(fn [s] (loop [remainder s, compressed [], final nil] (if-let [[x & xs] remainder] (if (not= x final) (recur xs (conj compressed x) x)
Previous
Next page