clojurecademy / 4Clojure

4Clojure problems with a few differences
https://clojurecademy.com/courses/17592186045426/learn/overview
8 stars 2 forks source link

28/46 my-comparison #31

Open AlexanderChenNL opened 6 years ago

AlexanderChenNL commented 6 years ago

Hi,

what do you want here? dont need the answer perse but would like a more clear explanation so I can program it better. Happy new year !

ertugrulcetin commented 6 years ago

Hi @AlexanderChenNL thanks for reaching out and happy new year as well! The thing is first arguments is an aid functions which means you can use it to understand the relation between those numbers(2nd 3th arguments).

Solution would explain itself better than I would:

(defn my-comparison 
  [op a b]
  (cond
    (op a b) :lt
    (op b a) :gt
    :else :eq))