
I am trying to analyze a list of items (say integers) for longest matches on patterns and their location on the list. One catch is that pattern may be defined in terms of other patterns. Example of patterns would be the any sequence of increasing numbers, or sequence of increasing numbers followed by upto 5 zeros then followed by any odd digits. I don't know much about the actual patterns, but would like to be able to define EDSL for composing the patterns and an execution environment to actually find the patterns. I like to find out various ways I can structure the problem and its trade offs. I appreciate any books, articles, suggestions, papers, etc on this type of problems. Thanks, Daryoush

Sounds like you need regular expressions applied to the string representation, although the "sequence of increasing numbers" is not something any of the standard regexp packages do. So you will have to roll your own. Alternatively you could use one of the parsing libraries to "parse" the string and define "sequence of increasing numbers" using a stateful parser. Paul. Daryoush Mehrtash wrote:
I am trying to analyze a list of items (say integers) for longest matches on patterns and their location on the list. One catch is that pattern may be defined in terms of other patterns. Example of patterns would be the any sequence of increasing numbers, or sequence of increasing numbers followed by upto 5 zeros then followed by any odd digits.
I don't know much about the actual patterns, but would like to be able to define EDSL for composing the patterns and an execution environment to actually find the patterns.
I like to find out various ways I can structure the problem and its trade offs. I appreciate any books, articles, suggestions, papers, etc on this type of problems.
Thanks,
Daryoush ------------------------------------------------------------------------
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Parsec 3 should be able to handle this pretty easily. It can parse any data structure that implements it's Stream class. Friendly, --Lane On Thu, 14 May 2009, Daryoush Mehrtash wrote:
I am trying to analyze a list of items (say integers) for longest matches on patterns and their location on the list. One catch is that pattern may be defined in terms of other patterns. Example of patterns would be the any sequence of increasing numbers, or sequence of increasing numbers followed by upto 5 zeros then followed by any odd digits.
I don't know much about the actual patterns, but would like to be able to define EDSL for composing the patterns and an execution environment to actually find the patterns.
I like to find out various ways I can structure the problem and its trade offs. I appreciate any books, articles, suggestions, papers, etc on this type of problems.
Thanks,
Daryoush
participants (3)
-
Christopher Lane Hinson
-
Daryoush Mehrtash
-
Paul Johnson