Hello everyone.

I¹ve been working for a couple of days in a small library for doing pattern
matching in Clojure.

Although it is just a sketch, is currently working. These are some examples
of how to use:

>(tuples/match (a b (c d) e)
                             (1 2 (3 4) 5) (+ b e))
7


>(def *test* '(:ok 2))
>(tuples/case *test*
              (s 1) (do (println (str "the state is not ok: " s)) s)
              (s 2) (do (println (str "the state is ok: " s)) s)
              t     (println "unknown value"))
the state is ok: :ok
:ok


(tuples/match (_ _ x) (1 2 3) x)
>3


If someone is interesting in improving it (I am not a clojure expert) or
wants to give it a try, the code is at github:
http://github.com/antoniogarrote/clj-tuples

Cheers.


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to