Take a look at clara-rules by Ryan Brush:

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

Clara pattern matches in the RETE tradition but works very well with 
Clojure records and maps (and Java objects.) Depending on how you 
expose/insert your data into the working memory will make it easier or 
harder to do what you are looking for. If done right you can query your 
data using a very powerful DSL built into Clara. The query feature is very 
much along the lines of what Datalog is for databases, only Clara works 
with in-memory data and/or across Storm clusters.

I am working on a Light Table plugin for Clara that will be released 
sometime in the next few weeks. This should help make it easier to 
visualize Clara rule bases and inspect RETE graph state, agenda, partial 
matches, etc.

Good luck!

Alan


On Sunday, January 19, 2014 11:26:59 AM UTC-8, Jozef Wagner wrote:
>
> s-expression is a notation, with which nested lists can be represented in 
> a textual form. In any lisp language, your code is not working with 
> s-expressions, but with a data structure, which is most likely a cons. 
>
> s-expressions provide a convenient textual representation from which you 
> can *read* or into which you can *print*. As Clojure offers more than one 
> basic data structure for collections, it needs multiple notations in order 
> to textually represent a collection type alongside its contents. While 
> there is a cons type in Clojure, the clj syntax does not support 
> traditional s-expression syntax for cons, e.g.  (a . (b . NIL)). Closest 
> you can get is with (a b), which creates a list.
>
> If your matcher does not need to differentiate between collection types, 
> you can treat all collections as sequences and that way you can uniformly 
> walk/transform any nested sequence.
>
> JW
>
>
> On Sun, Jan 19, 2014 at 6:40 PM, Dave Tenny <dave....@gmail.com<javascript:>
> > wrote:
>
>> As I try to reconcile my ancient past in writing common lisp code with a 
>> clojure learning exercise, 
>> I wonder whether clojure philosophy redefines the notion of an 
>> s-expression
>> or whether it just  adds vectors and maps to s-expressions in without 
>> trying to define what an s-expression is.
>>
>> The question came up as I was looking for a certain capability in clojure 
>> libraries.
>>
>> Back in the day when lisps had only parenthesized collection types, there 
>> were lisp libraries
>> (whose names I've long since forgotten) that would allow pattern matching 
>> of s-expressions,
>> so that you could describe a pattern, match it to some tree, pick up 
>> matches and continue to match some more.
>>
>> Sort of like java.util.Matcher.find().
>>
>> However with every clojure program (and program output) being a huge set 
>> of lists, vectors, and maps
>> I was looking for an s-exp matcher that would allow pattern expressions 
>> of and matching against paths of combinations of these data structures.
>>
>> Sort of like enlive/select can traverse a nasty list/vector/map output of 
>> enlive/html-resource with predicates that will match a sequence of nodes in 
>> the web page.
>> (Only I don't think enlive/select returns matcher state that allows 
>> continuation from where you left off, maybe it does, and of course it's 
>> html oriented).
>>
>> Looking at the clojure.walk and clojure.zip stuff, I don't see anything 
>> other than low level tools for certain kinds of traversals.
>>
>> What libraries are there for higher level "reach in and grab patterns of 
>> data" abstractions that will work against a tree of lists/vectors/maps (and 
>> preferably any other walkable data structure in clojure)?
>>
>> Looking for suggestions, and whatever philosophy there is about 
>> s-expressions in clojure like reader environments.
>>
>> If I wanted lists, vectors, and maps with no zen, I'd be using python ;-)
>>
>> Thanks!
>>
>> -- 
>> -- 
>> 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 the Google Groups 
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, 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