Hi!
Pattern matching is fine for sequence or vector destruction.
Is is possible to destruct map and make pattern machting?
For example I would like to make constraint for to some query service.
It would be done as map for example: { :name "Tom" :surname "Jakarta"
:birthDate (Date.) } or { :personalId "12312312132" }
Then I would like to dispatch this Value Object:
(defn service
([ {:keys [name surname]} ] (println "searching by personal data"))
([{:keys [personalId]} ] (println "searching by id")))
Why using map instead of specific type of VO?
Because I don't want to decleare types of VO which doesn't bring any value
to domain problem.
Maybe matchure or other lib already implements it?
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
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