Clojure - LDC

557 views

Published on

Apresentação de 3 funções do clojure pro LDC da minha empresa

Published in: Technology, Spiritual
  • Be the first to comment

  • Be the first to like this

Clojure - LDC

  1. 1. MAX
  2. 2. Max● (max 1 2 27 42 33)● = 42
  3. 3. Min
  4. 4. MIN● (min 1 2 27 42 33)● =1
  5. 5. Rand
  6. 6. Rand● (rand 10)● 7.99291708123879● (rand 10)● 4.400075418607131● (rand 10)● 3.945087811483189
  7. 7. Rand-Int● (rand-int 10)● 3● (rand-int 10)● 9● (rand-int 10)● 7
  8. 8. Tema● (defn● calc● "calculadora tema do ldc!!!"● [o x y]● (if (= "+" o) (+ x y)● (if (= "-" o) (- x y)● (if (= "*" o) (* x y)● (if (= "/" o) (/ x y))))))●● (prn (calc "+" 4 5)) ;; Retorno deve ser: 9● (prn (calc "-" 5 1)) ;; Retorno deve ser: 4● (prn (calc "*" 2 3)) ;; Retorno deve ser: 6● (prn (calc "/" 27 3)) ;; Retorno deve ser: 9

×