While playing around with this I came across an error message in match that
could perhaps stand some improvement ...
> (define (super-cool?/flawed ds)
(match ds
[(list _ ... a a ... _) #t]
[_ #f]))
a59: unbound identifier;
also, no #%top syntax transformer is bound in: a59
Dan
-
I don't know what the exact specs are, but what should be the return values
for '(a a a b b c) and '(a a b b b c) ?
(I can't test right now but I suspect the match approach might miss one)
On Wed, Dec 4, 2019, 23:56 Matthew Butterick wrote:
>
> On Dec 4, 2019, at 3:26 PM, 'Joel Dueck' via Rac
> On Dec 4, 2019, at 3:26 PM, 'Joel Dueck' via Racket Users
> wrote:
>
> I like the trick of using list* to match _ on any number of trailing
> elements. The grammar given in the docs doesn't seem to include it; I'm
> curious by what rule is it "allowed" as a pattern?
It's a synonym for the
I feel stupid too!
I like the trick of using list* to match _ on any number of trailing
elements. The grammar given in the docs doesn't seem to include it; I'm
curious by what rule is it "allowed" as a pattern?
On Wednesday, December 4, 2019 at 5:02:48 PM UTC-6, Sorawee Porncharoenwase
wrote:
This is super cool indeed. Now I feel stupid.
On Wed, Dec 4, 2019 at 2:56 PM Matthew Butterick wrote:
>
> On Dec 4, 2019, at 2:39 PM, 'Joel Dueck' via Racket Users <
> racket-users@googlegroups.com> wrote:
>
> So it seems easy to match "*at least *N identical elements".
> But is there a method f
> On Dec 4, 2019, at 2:39 PM, 'Joel Dueck' via Racket Users
> wrote:
>
> So it seems easy to match "at least N identical elements".
> But is there a method for matching "no more than N identical elements"?
?
#lang racket
(require rackunit)
(define (super-cool? lst)
(match lst
[(and (l
(This is related to the problem for this year’s Advent of Code day 4,
so...SPOILERS.)
(I did solve both parts of today's problem, so this is more for my own
edification.)
The problem involves finding lists of numbers, one of the criteria for
which is that the list has at least two consecutive i
7 matches
Mail list logo