On Oct 27, 10:45 pm, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote:
> I used Stuart Sierra's 'fcase' contrib today to good effect. Nice job,
> Stuart!

Thanks!

On Oct 28, 9:35 am, Rich Hickey <[EMAIL PROTECTED]> wrote:
> If you'd like, I think the effort would be better spent on making a
> version of fcase for the base library.

Cool!

> I'd like to save unadorned "case" for this meaning.

Fine by me.

> There is implicit arg ordering (pred clause-value test-value) which
> doesn't matter for some preds (=) but does for others (instance?). For
> the uses thus far, this order seems good - instance? and re-find work
> well, but there will be cases where people will want (pred test-value
> clause-value). The order of things in the macro structure might imply
> the latter:
...
> (condp (= x _)         ;doesn't matter
> (condp (instance? _ x)
> (condp (some #{x} _)

How about just one argument, the predicate:  (condp #(= x %) ...)
That would resolve the issue without adding syntax, no?

> As far as the default, providing a default value as odd last clause is
> ok, but subtle, and could use layout help, if we do that we should do
> the same for cond.

I stole that idea from Arc's "if", which has the interesting quality
of unifying "if" and "cond".  I often use the "else" clause to throw
an exception:

(condp #(= x %)
  42 "The Meaning of Life"
  13 "Unlucky"
  1 "The loneliest number"
  (throw (Exception. "Nothing matched."))

I feel like "econdp" would be less clear, since you don't know what
kind of exception should be thrown.  Plain old Exception? Or
RuntimeError?

> Finally there is the name, which has to follow the form and function.
> If we go with something like the last above, I like condp/econdp.

I'm not sure about condp, only because Clojure hasn't used the CL-ish
"-p" suffix anywhere else.  Ideas: condfn, fcond, cond-apply, cond-
with, try-each,...
-S
--~--~---------~--~----~------------~-------~--~----~
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
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