On Wed, 22 Oct 2008, Brad Bowman wrote:


The "scrap your boilerplate" scheme for generics in Haskell addresses
traversals, queries, transformations, parallel zipping and the like.
I've only briefly felt like I understood it, so I was going to
revise before trying to adapt it to Perl 6. (Any lambdacamels out there that do understand this stuff?)

There's a paper called "Scrap your boilerplate with XPath-like combinators" <http://homepages.cwi.nl/~ralf/popl07/> which ties
nicely into this thread.  It and other SYB papers provide a
useful perspective on this traversal and matching domain,
even if the Haskell details are tricky.

SYB home: http://www.cs.vu.nl/boilerplate/

Hmm. Without reading it, I came up with the following while I was working on a tree iterator. Basically, I figured pretty much every useful iterator can be specified as a combination of axes, and an axis can be defined with the following four attributes:

-       bearing: this is the direction within the tree, and can be any of
"self", "descendant", "sibling", "ancestor", and "attribute". - route: this is basically the search algorithm used; currently only depthfirst is supported, and this is (and will remain) the default. - direction: This is which direction you're going through the search
        algorithm, and can be any of "self", "following", "preceding", and
"any". The default is "any". - depth: the maximum depth of search to use. The default is Inf

        Then there are special cases.  For example, "child" is:
-       bearing: descendant
-       depth: 1

        Anyway, you get the general idea.

But my overall aim is that you should be able to iterate over a tree in a variety of ways, and run pretty much any Perl code on it, and that selection should work somehow.

        :)


---------------------------------------------------------------------
| Name: Tim Nelson                 | Because the Creator is,        |
| E-mail: [EMAIL PROTECTED]    | I am                           |
---------------------------------------------------------------------

----BEGIN GEEK CODE BLOCK----
Version 3.12
GCS d+++ s+: a- C++$ U+++$ P+++$ L+++ E- W+ N+ w--- V- PE(+) Y+>++ PGP->+++ R(+) !tv b++ DI++++ D G+ e++>++++ h! y-
-----END GEEK CODE BLOCK-----

Reply via email to