Don't think Rich Hickey is a fan of pattern matching, which is probably why 
it is not in core to begin with.

If you watch his "Simple made easy" talk, pattern matching is one of the 
items listed under *Complexity Toolkit*, with this description: "Complects 
multiple who/what pairs".

I'm not sure where core.match is positioned - might have a better change to 
get added there?

On Thursday, 25 September 2014 19:09:03 UTC+2, Ivan L wrote:
>
> Is this clojurescript ready?  This looks amazing, I would also love to 
> have it in core.
>
> On Sunday, September 14, 2014 2:47:28 AM UTC-4, dennis wrote:
>>
>>
>> Hi , i am pleased to introduce defun 
>> <https://github.com/killme2008/defun>: a beautiful macro to define 
>> clojure functions with pattern match.
>>
>> Some examples:
>>
>>
>> (defun say-hi
>>
>>   ([:dennis] "Hi,good morning, dennis.")
>>
>>   ([:catty] "Hi, catty, what time is it?")
>>
>>   ([:green] "Hi,green, what a good day!")
>>
>>   ([other] (str "Say hi to " other)))
>>
>>
>> (say-hi :dennis)
>>
>> ;;  "Hi,good morning, dennis."
>>
>> (say-hi :catty)
>>
>> ;;  "Hi, catty, what time is it?"
>>
>> (say-hi :green)
>>
>> ;;  "Hi,green, what a good day!"
>>
>> (say-hi "someone")
>>
>> ;;  "Say hi to someone"
>>
>>
>> Recursive function? It's all right:
>>
>> (defun count-down
>>
>>   ([0] (println "Reach zero!"))
>>
>>   ([n] (println n)
>>
>>      (recur (dec n))))
>>
>> (defun fib
>>
>>     ([0] 0)
>>
>>     ([1] 1)
>>
>>     ([n] (+ (fib (- n 1)) (fib (- n 2)))))
>>
>>
>>
>> Guard functions? it's all right:
>>
>> (defun valid-geopoint?
>>
>>     ([(_ :guard #(and (> % -180) (< % 180)))
>>
>>       (_ :guard #(and (> % -90) (< % 90)))] true)
>>
>>     ([_ _] false))
>>
>>
>> (valid-geopoint? 30 30)
>>
>> ;; true
>>
>> (valid-geopoint? -181 30)
>>
>> ;; false
>>
>>
>> It's really cool,all the magic are from core.match, much more details 
>> please see 
>> https://github.com/killme2008/defun
>>
>>
>> -- 
>> 庄晓丹 
>> Email:        killm...@gmail.com xzh...@avos.com
>> Site:           http://fnil.net
>> Twitter:      @killme2008
>>
>>
>> 

-- 
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/d/optout.

Reply via email to