On 9/28/2020 10:50 AM, Beatriz Moreira wrote:
Hello,
I would like to know how do I match multiple variables to a regular
expression.
My idea is to match every *f* variables (f...) to an *f* in ((contract
C ((T x) ...) ((T f)) ...) ... ).
I am trying to implement a core language for smart contracts in
Racket, but I need to have as pre condition in my reduction rules that
the *f* is a function in one of the contracts.
Thank you! :)
'regexp-match*' outputs a list of matched strings, and match has an
apply clause: '(app /expr/ pats ...)' which evaluates /expr/ and tries
to match the output. My first thought would be to try something like:
match ( inp )
:
((app (regexp-match* pattern inp) match1 match2 ... )
... )
:
Caveat ... I've never tried to do this. If match doesn't like this
approach (or something close to it), then I would separately perform the
regexp-match* and the pattern match on its output list.
Hope this helps,
George
https://docs.racket-lang.org/reference/regexp.html
https://docs.racket-lang.org/reference/match.html
--
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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/racket-users/22de3af2-b64f-73c0-fe12-a832dccf6086%40comcast.net.