On May 13, 2011, at 14:37 , David Nolen wrote:

> On Fri, May 13, 2011 at 2:04 AM, Heinz N. Gies <he...@licenser.net> wrote:
> Hearing Pattern Matching,
> do you mean Erlang like Pattern matching?
> 
> Regards,
> Heinz
> 
> Erlang, OCaml, SML, Haskell, Scala all have the kind of pattern matching I'm 
> talking about. One important point is that they all support guards on 
> patterns. It's not clear to me that current implementation actually use 
> guards to shape the tree, but that is my plan. In the system I'm proposing 
> guards are actually logical predicates that can be reasoned about.
> 
> (match n
>    ([x] :guard [(number? x)]
>     ...)
>    ([0] ...))
> 
> This is not ok in OCaml, SML, or Haskell (or Scala and Erlang as far as I 
> know). This would be ok in the system I'm proposing since number? is a 
> logical predicate and we can test for such cases and reorder the pattern.
Erlang not only allows predicate functions, simple math is also just fine like 


f(x) when x < 0 ->
...

then again erlangs reasoning for only allowing certain BIF's and simple 
arithmetics in guards is speed, those are writtin in plain C so are blazing 
fast compared to erlang functions ^^. That is a issue Clojure does not have to 
face so I don't think it would make sense to limit the code you can put in 
guard expressions.

Regards,
Heinz

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to