Arc Forumnew | comments | leaders | submitlogin
11 points by pg 6169 days ago | link | parent

Better string processing. I didn't want to just automatically adopt the existing regexp convention. But since there is no alternative yet, dealing with strings is awkward.


2 points by CatDancer 6169 days ago | link

Update: I see sjs is waaay ahead of me http://arclanguage.org/item?id=1430

I enjoyed using the Haskell Parsec library:

  http://legacy.cs.uu.nl/daan/download/parsec/parsec.html
It might be worth taking a look at for ideas, if you haven't seen it already.

Here's part of a JSON parser I wrote once:

  exponent_part =
    (string "e" <|> string "E")
    `followed_by` (string "+" <|> string "-")
    `followed_by` many1 digit
I wouldn't call it perfect... still too much work to keep Haskell happy, but certainly a lot nicer than using regexp's.

-----

2 points by partdavid 6168 days ago | link

I think "better string processing" is below the level of writing a grammar, even a mini-grammar.

If you treat strings as lists of characters and have good pattern-matching, this problem mostly solves itself, without something as ugly as regular expressions. You have the rich set of list operations, function-based predicates and, with clause selection by pattern, that's mostly what you need.

Yes, I know strings-as-lists seems like a terribly unoptimal thing to do; but it's an optimization challenge (how to optimize a particular backing representation of lists so that certain kinds of operations--subset matching, tokenizing, etc.--happen efficiently?), not something to bake into the language.

-----