Question: in clojure Write a procedure, (my-max p v1 ...), of two or more arguments. Include unit tests. The first argument will be a predicate,
" in clojure"
Write a procedure, (my-max p v1 ...), of two or more arguments. Include unit tests. The first argument will be a predicate, p, indicating a greater than relationship. my-max must return the largest of its subsequent arguments according to p. In the event of a tie (a <= b and b <= a so a = b) my-max must return the first occurrence of the largest value. Sample runs: > (my-max > 9 1 2 3 17 7 9) 17 > (my-max (fn [s1 s2] (> (count s1) (count s2))) "Hello" "Goodbye" "Frog" "Cat" "Dog" "Eybdoog")) "Goodbye"
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
