On Thu, Mar 17, 2016 at 1:27 PM, Matthew Butterick <m...@mbtype.com> wrote:

> What is the best approach to destructuring strings using predicates? For
> instance "match a substring for which `string->number` is true."
>
>
I am imagining an API that utilizes SCSH style regexes but allows you to do
something like this (fictional):

(define-values (area prefix line) (sre-match (: (= digits 3) (_? "-") (=
digits 3) (_? "-") (= digits 3))))

The `_` at the head of each component would essentially operate like `_`
does in structural pattern matching (e.g. ignore), but give you the ability
to specify a regexp that you are ignoring.

This may not be exactly what you are thinking of, but it's the half baked
idea that came to mind... The API, would also be pretty damn ugly.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to