core.match can do some of this. https://github.com/clojure/core.match

data.zip has some extensions beyond zip that are useful (although a lot of 
what's there is cast in terms of xml-handling uses): 
https://github.com/clojure/data.zip

I have rolled variants of this a few times, mostly using zippers as the 
primary tool at the bottom. I wrote up some early variants of that work 
at http://www.ibm.com/developerworks/library/j-treevisit/ - the actual 
versions went quite a bit further but are not open source. Where we ended 
up was something that let you describe a pattern (support for basic Clojure 
data structures + records) for matches with bound variables, then invoke 
arbitrary transformation functions at the point of match.

Alex

On Sunday, January 19, 2014 11:40:39 AM UTC-6, Dave Tenny 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 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