[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: regexp and valid-sre?

This page is part of the web mail archives of SRFI 115 from before July 7th, 2015. The new archives for SRFI 115 contain all messages, not just those from before July 7th, 2015.

On Tue, Nov 26, 2013 at 12:34 PM, Michael Montague <mikemon@xxxxxxxxx> wrote:
Why can the procedure 'regexp' be called with an already compiled <re> which is just returned?

Why is the procedure 'valid-sre?' necessary? You could just call 'regexp' and use 'guard' to check for any errors.

Indeed, in fact `valid-sre?' could be defined as:

  (define (valid-sre? x)
    (guard (else (exn #f)) (regexp x)))

Whether you want to test in advance or catch errors
after the fact is a matter of personal style.