That's very cool. Thank you, Matthew.
On Fri, Mar 3, 2017 at 6:50 PM, Matthew Butterick wrote:
>
> On Mar 2, 2017, at 9:17 AM, David Storrs wrote:
>
> I could, it's just extremely more verbose and therefore obfuscates what's
> actually going on as compared to the 'map' form.
>
>
> Why not turn
> On Mar 2, 2017, at 9:17 AM, David Storrs wrote:
>
> I could, it's just extremely more verbose and therefore obfuscates what's
> actually going on as compared to the 'map' form.
Why not turn it into a macro that preserves your preferred notation:
#lang racket
(struct foo (a b c) #:transpar
There is a "generic" `sequence-map`.
But it's not variadic like `map` -- and like you want in your example.
You could try writing a variadic `sequence-map`?
As for `for/list`, you _could_ write:
(for/list ([a as]
[b bs]
[n (in-naturals)])
(foo a b n))
It's faster if yo
On Thu, Mar 2, 2017 at 12:15 PM, David Storrs
wrote:
>
>
>
> On Thu, Mar 2, 2017 at 11:22 AM, David Christiansen <
> da...@davidchristiansen.dk> wrote:
>
>> > Not with map, which requires equal-length arguments.
>> >
>> > You could do the slightly less ugly:
>> >
>> > (map
>> > foo
>> > l
On Thu, Mar 2, 2017 at 11:22 AM, David Christiansen <
da...@davidchristiansen.dk> wrote:
> > Not with map, which requires equal-length arguments.
> >
> > You could do the slightly less ugly:
> >
> > (map
> > foo
> > lst-A
> > lst-B
> > (range (length lst-A)))
>
> Why not do it this
> Not with map, which requires equal-length arguments.
>
> You could do the slightly less ugly:
>
> (map
> foo
> lst-A
> lst-B
> (range (length lst-A)))
Why not do it this way?
(struct foo (a b c))
(define lst-A '(a b))
(define lst-B '(d e))
(for/list ([a (in-list lst-A)]
Not with map, which requires equal-length arguments.
You could do the slightly less ugly:
(map
foo
lst-A
lst-B
(range (length lst-A)))
On Thu, Mar 2, 2017 at 11:14 AM, David Storrs wrote:
>
>
> On Thu, Mar 2, 2017 at 10:09 AM, Stephen Chang wrote:
>>
>> The in-X forms are sequ
On Thu, Mar 2, 2017 at 10:09 AM, Stephen Chang wrote:
> The in-X forms are sequences, and must be used with the sequence API, ie
> for/X.
>
> map only works with lists, so you could use build-list or range:
> (map
> foo
> lst-A
> lst-B
> (range 2))
>
> Is there a way to do it if I
The in-X forms are sequences, and must be used with the sequence API, ie for/X.
map only works with lists, so you could use build-list or range:
(map
foo
lst-A
lst-B
(range 2))
On Thu, Mar 2, 2017 at 9:55 AM, David Storrs wrote:
> I'd like to be able to do something like this:
>
I'd like to be able to do something like this:
(struct foo (a b c))
(define lst-A '(a b))
(define lst-B '(d e))
(map
foo
lst-A
lst-B
(in-naturals))
I'd expected this to produce: (foo 'a 'd 0) (foo 'b 'e 1), but instead it
throws an exception "expected list, given stream". I coul
10 matches
Mail list logo