On Monday, February 17, 2014 6:43:18 PM UTC-5, Laurent Droin wrote:
>
>
> (def inf Long/MAX_VALUE)
> (defn quantize
>   [x markers values]
>   (let 
>     [f (partial (fn([%1 %2 %3] (cond (<= %1 %2) %3))) x)]
>     (first (filter #(not (nil? %))(map f (conj markers inf) values)))))
>
>
The reason I didn't go with Long/MAX_VALUE is that it breaks down for 
 arbitrary precision and bigints which is a no-no for me.

There is many many ways this function could look. Mine is just one example. 
For instance many clojurist's would probably prefer to call it like this:

(quantize 0 :small 5 :med :10 :large :huge).

I didn't go through your code. But many people don't like to overuse 
anonymous functions especially if you use 3 parameters (what is %1, %2 %3?, 
if they had a name it'd be clearer). But this is just style so it's very 
subjective.

Cheers

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to