Feedback on my code

Hello

I solved all the first steps challenges of this page ( https://exercises.clojure.camp/)
Can anyone give me feedback if I did a good job here.

Code so far: clojure_learning/src/roelof/easy.clj at main · RoelofWobben/clojure_learning · GitHub

  1. The ns form is duplicated at the top - you can remove the one without :require
  2. Things like (< a 0) and (> a 0) can be written as (neg? a) and (pos? a)
  3. I’d implement clamp as (defn clamp [x min-x max-x] (min max-x (min min-x x)))
  4. There are some issues in formatting. Just in case - there are tools for formatting code, you don’t have to do it by hand

Other than that, no comments. But I also didn’t try to make sense of what the code actually does

Thanks, I will change that

Sorry your clamp is not working well


 FAIL in () (easy.clj:138)
; valid triangle non valid triangle valid triangle on the sides non-valid on one side a  triangle test clamp
; expected: (= (clamp 2 1 4) 2)
;   actual: (not (= 1 2))
; ❌ FAIL in () (easy.clj:138)
; valid triangle non valid triangle valid triangle on the sides non-valid on one side a  triangle test clamp
; expected: (= (clamp 0 1 4) 1)
;   actual: (not (= 0 1))
; ❌ FAIL in () (easy.clj:138)
; valid triangle non valid triangle valid triangle on the sides non-valid on one side a  triangle test clamp
; expected: (= (clamp 5 1 4) 4)
;   actual: (not (= 1 4))


Sorry, a typo. Should be

(defn clamp [x min-x max-x]
  (min max-x (max min-x x)))

Thanks, that works
and also thanks for the feedback