> (map #(fif even? (fn [x] (* 2 x))) [3 4])

Your fif returns a function. So probably what you wanted to do was:
user=> (map (fif even? (fn [x] (* 2 x))) [3 4])
(nil 8)
fif is returning an unnamed function which accepts one argument and
can thus be mapped to [3 4]

#(...) creates an unnamed function, in your case it was creating a
function with no arguments.
So to use that syntax correctly you might do:
(map #(if (even? %1) (* 2 %1)) [3 4])
The point of fif is to simplify the above, though I guess for this
example it actually makes it longer :)

You could have written fif as
(defn fif [iff then & else] #(if (iff %1) (then %1) (if else ((first
else) %1))))


Regards,
Tim.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to