On Mon 17 Mar 2014 at 09:16:25PM -0700, Timothy Pratley wrote:
> Is there a better way to write
>
> (cond
> (neg? 1) "neg"
> (zero? 1) "zero"
> (pos? 1) "pos"
> :default "default")
…
> But I think I'm missing a more idiomatic approach.
FWIW, the `compare` function works well in this partic
Nice, thanks!
--
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
On Mon, Mar 17, 2014 at 09:16:25PM -0700, Timothy Pratley wrote:
> I came up with this:
>
> (condp #(%1 %2) 1
> neg? "neg"
> zero? "zero"
> pos? "pos"
> = "default")
>
> Which I wouldn't so much mind if I knew the name for #(%1 %2)
I usually call it `funcall` (like in Common Lisp):
(d
Hi,
Is there a better way to write
(cond
(neg? 1) "neg"
(zero? 1) "zero"
(pos? 1) "pos"
:default "default")
I came up with this:
(condp #(%1 %2) 1
neg? "neg"
zero? "zero"
pos? "pos"
= "default")
Which I wouldn't so much mind if I knew the name for #(%1 %2)
And this:
(defma