Not yet, although I would like to make use of simple maps natural. I had
been toying with the idea of typing into the :type metadata that could be
attached to a map, allowing expressions like:

(defrule test-rule
   [:example/person-map-type (= "Alice" (:first-name this))]
   =>
   (println "Hello, Alice!"))

That way any map with that type annotation could be used in the rule. Today
Clara does automatically bind "this" as a reference to the matched object,
so functions can be called against it. (I'm not particularly thrilled by
the implicit binding of "this", but it is common in rules engines so I
included it here.)

The advantage of records is they have a pre-defined type and pre-defined
fields, so they are a natural alternative to facts and slots seen in other
production systems. But since simple maps are so common in Clojure code I
do want to incorporate them here, either by tapping into the type metadata
as seen in the above example, or by doing something akin to how
multimethods work, where the fact "type" is effectively defined by a
function.

I'd love to hear suggestions on this one. The goal is to get the advantages
of a production system in a way that feels natural to Clojure developers.
What would feel most natural to members of this group?

On Wednesday, September 25, 2013, zcaudate wrote:

> Hi Ryan!
>
> Great work. Can normal clojure maps can be used instead of records?
>
> --
> --
> 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<javascript:;>
> 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 <javascript:;>
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "Clojure" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/clojure/pfeFyZkoRdU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> clojure+unsubscr...@googlegroups.com <javascript:;>.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
-- 
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/groups/opt_out.

Reply via email to