> On Dec 20, 2016, at 3:45 PM, Alexis King wrote:
>
>> On Dec 20, 2016, at 07:54, Alex Knauth wrote:
>>
>> Oooh, that's pretty cool. Much better than my super-slow attempt.
>>
>> Should you make this into a package (I would certainly use it a lot)
> On Dec 20, 2016, at 07:54, Alex Knauth wrote:
>
> Oooh, that's pretty cool. Much better than my super-slow attempt.
>
> Should you make this into a package (I would certainly use it a lot)
> or would it make more sense to add in a pull request to the existing
>
Thanks Alexis!
That's such an elegant solution. I'm a little in awe of all the pieces that
you pulled together to make it work.
Fantastic!
In terms of surface syntax, I think that your straight extension to match
is preferable to what I asked for, allowing this sort of thing
(match s
> On Dec 20, 2016, at 4:35 AM, Alexis King wrote:
>
> One relatively easy solution would be to just compile patterns to
> regular expressions and use Racket’s built-in match form. Writing this
> as a match-expander is fairly straightforward:
>
> #lang racket
>
>
> On Dec 20, 2016, at 12:59 AM, Daniel Prager wrote:
>
> This isn't too bad, but What I'd *really* like is a "string-match" form to
> more elegantly process structured data, via a few strings based on a simple
> (and greedy) left-to-right algorithm.
>
> But my
Excellent idea using a pattern expander.
Alexis didn't give an example:
> (match "abc--123 foo end"
[(str a "--" b " " c " end") (list a b c)])
'("abc" "123" "foo")
/Jens Axel
2016-12-20 10:35 GMT+01:00 Alexis King :
> One relatively easy solution
One relatively easy solution would be to just compile patterns to
regular expressions and use Racket’s built-in match form. Writing this
as a match-expander is fairly straightforward:
#lang racket
(require (for-syntax racket/string
syntax/parse/experimental/template)
While working through many of the puzzles in this year's adventofcode.com I
tend to parse the input with a sequence of string-splits.
This isn't too bad, but What I'd *really* like is a "string-match" form to
more elegantly process structured data, via a few strings based on a simple
(and greedy)
8 matches
Mail list logo