[racket] Combining iteration and match

From: Stephen Chang (stchang at ccs.neu.edu)
Date: Thu Sep 5 01:58:42 EDT 2013

> This kind of overhaul is not something we can do externally to one of the most used, non-trivial collection of macros in the Racket code base. We also have to use a more conservative language to implement it, since it's so low on the language tower. Perhaps later this year I'll have time to submit a pull-request that opens the for macros up a bit more in this fashion, but I anticipate a heavy push-back from core developers due to its supreme importance to Racket's foundation.

As a simpler alternative, can racket/private/for.rkt just provide some
of the currently-internal sequence-transformer functions? Wouldn't
this allow someone to implement alternative, performant for/X forms
without touching the core? Looking at the code, I'm thinking maybe
"expand-clause"?




>
> -Ian
>
> ----- Original Message -----
> From: "Asumu Takikawa" <asumu at ccs.neu.edu>
> To: "Konrad Hinsen" <konrad.hinsen at fastmail.net>
> Cc: users at racket-lang.org
> Sent: Tuesday, September 3, 2013 9:12:54 AM GMT -05:00 US/Canada Eastern
> Subject: Re: [racket] Combining iteration and match
>
> On 2013-09-03 11:32:23 +0200, Konrad Hinsen wrote:
>>   (for/list ([(list a b) some-sequence])
>>     a)
>
> I usually use `match-define`:
>
>   (for/list ([a+b some-sequence])
>     (match-define (list a b) a+b)
>     a)
>
> Can be slightly longer than just `match` for simple cases, but doesn't
> cause rightward drift.
>
> Cheers,
> Asumu
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
>
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users


Posted on the users mailing list.