Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

3 little clojure functions

672 views

Published on

clojure, dev, functions, functional

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

  • Be the first to like this

3 little clojure functions

  1. 1. 2 little (assoc, subs) functions 1 big macro (dosync) …and The Calc Function@diego_pacheco
  2. 2. Yes, I’m a geek guy.(And I like dinosaurs) @diego_pacheco diego-pacheco.blogspot.com github.com/diegopacheco
  3. 3. Remember… Respect The REPL
  4. 4. Remember…(NO enterprise java Bullshit PLEASE)
  5. 5. assoc
  6. 6. subs
  7. 7. Dosync (macro)
  8. 8. Calc function(calc "+" 4 5) ;; Result must be : 9(calc "-" 5 1) ;; Result must be : 4(calc "*" 2 3) ;; Result must be : 6(calc "/" 27 3) ;; Result must be : 9 Live DEMO with REPL
  9. 9. Calc 1
  10. 10. Calc 2
  11. 11. Calc 3
  12. 12. Calc 4
  13. 13. Whats Next ?Homework (all)• 3 new Functions from clojure.core• 4 new functions (exercises) with Unit Testing • (car-tax [c1 c2 c3 c4]) • (bank-deposit ac1 10) • (bank-withdraw ac1 5) • (bank-assessment ac1)
  14. 14. Whats Next ?car-tax [vector-of-cars]Car must be a struct with owner-name, car-type, cur-speed and license-plate. Cars thatcurrent speed is grater than 100 pay 10 plus20 each 1 beyond 100. This func must add theproperty tax with proper value to the car.
  15. 15. Whats Next ?bank-* [account]Bank account is a struct with name and value.All changes must be persistent(ref) and youmust pass the account in all operations. Youmust use STM for this functions as well.
  16. 16. Whats Next ? (When I back from London…)DEV
  17. 17. Recommended Books
  18. 18. (pr “Thanks All Folks”)@diego_pacheco

×