News for hackers. Stuff that matters.
Re:Regular Expression Engine in 14 lines of Python by abecedarius on Sunday November 06, 2011 @06:30PM (#3204257)
How about

    eat = lambda chars: lambda s: s[1:] if s and s[0] in chars else None
    alt = lambda p, q: lambda s: (lambda r: q(s) if r is None else r)(p(s))
    seq = lambda p, q: lambda s: (lambda r: None if r is None else q(r))(p(s))
going a bit far in the short-names direction, oh well. :) It's too bad Python has this artificial statement/expression distinction.

There are no comments on this comment yet.