Hey, I appreciate the thoughts. Funny how posting a project yields use 
cases you've never thought of. I went ahead and logged an issue to track 
arbitrary maps as facts here:

https://github.com/rbrush/clara-rules/issues/6

I'm looking for ways to align with you needs, but I don't see an 
immediately obvious way to do so. Out of respect for this mailing list, it 
probably seems best to use the github issue to go deeper on this one. 

-Ryan

On Thursday, September 26, 2013 5:03:24 PM UTC-5, zcaudate wrote:
>
> Hi Ryan!
>
> Thanks for your response. I would love to see maps and nested maps as part 
> of the rules. I find that clara provides great syntax for defining inputs 
> and outputs and I would love to use it as a rules engine just beneath my 
> front end. 
>
> However, most of my work is web based, data is javascript and so I'm 
> converting it into clojure maps and dispatching based on routes
>
> I'm not sure adding a :type field would be a good idea. I've implemented 
> something much simpler to work with arrays of elements with different ways 
> that elements can be selected and its better to work directly with the data 
> itself rather than tag….
>
> I'm really hoping that something similar could be implemented in with 
> routes and data… something like:
>
> (defmaprule notify-client-rep
>   "Find the client represntative and send a notification of a support 
> request."
>    [:support/request [req] (== ?client (:client req))
>    [:add/client/representive [req]  ((req :clients) ?client) (== ?name 
> (:name req))]
> => (println "Notify" ?name "that" ?client "has a support request")
> )
>
>
> On 27/09/2013, at 12:23 AM, Ryan Brush <rbr...@gmail.com <javascript:>> 
> wrote:
>
> 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
>> 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 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.
>> 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 clo...@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+u...@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+u...@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