For all the good qualities of the Clojure group, it can sometimes produce a bit of a harsh tone. Don't let that get you down though, it's great that you're building stuff and showing it off!
As far as defun goes, it looks interesting. The out-of-the-box pattern matching was one of the things I enjoyed with ML. It's usually a quite tidy way to handle the termination conditions of recursions. It's less useful in Clojure, since we're more or less confined to loop and recur, but I still like the looks of this. On Sunday, September 14, 2014 8:47:28 AM UTC+2, 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 <javascript:> xzh...@avos.com > <javascript:> > 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.