Re: [racket-users] for/list with in-parallel lists

2017-07-10 Thread Jon Zeppieri
On Tue, Jul 11, 2017 at 12:56 AM, Alex Knauth wrote: > > You can do this with the Generic Bind package [1]. Oh, this is very nice. Thank you. -J -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this

Re: [racket-users] for/list with in-parallel lists

2017-07-10 Thread Nadeem Abdul Hamid
Nice, thank you! On Mon, Jul 10, 2017 at 10:56 PM, Alex Knauth wrote: > > On Jul 11, 2017, at 12:38 AM, Nadeem Abdul Hamid wrote: > > ... though a syntactic solution combining for and match would probably >> be better. >> > > Yes, please!... > Look, python

Re: [racket-users] for/list with in-parallel lists

2017-07-10 Thread Alex Knauth
> On Jul 11, 2017, at 12:38 AM, Nadeem Abdul Hamid wrote: > > ... though a syntactic solution combining for and match would probably > be better. > > Yes, please!... > Look, python can do it: > > >>> [(x, z) for (x, y, z) in [(1, 2, 3), (4, 5, 6), (7, 8, 9), ('a', 'b', > >>>

Re: [racket-users] for/list with in-parallel lists

2017-07-10 Thread Nadeem Abdul Hamid
> > ... though a syntactic solution combining for and match would probably > be better. > Yes, please!... Look, python can do it: >>> [(x, z) for (x, y, z) in [(1, 2, 3), (4, 5, 6), (7, 8, 9), ('a', 'b', 'c')]] [(1, 3), (4, 6), (7, 9), ('a', 'c')] :-) -- You received this message because you

Re: [racket-users] for/list with in-parallel lists

2017-07-10 Thread Jon Zeppieri
On Tue, Jul 11, 2017 at 12:28 AM, Jon Zeppieri wrote: > > As far as I know, there's nothing built-in that does this, but it's > not hard to build: > ... though a syntactic solution combining for and match would probably be better. -- You received this message because you

Re: [racket-users] for/list with in-parallel lists

2017-07-10 Thread Jon Zeppieri
On Tue, Jul 11, 2017 at 12:16 AM, Nadeem Abdul Hamid wrote: > I'm looking for a general solution. Basically, I thought binding multiple > id's would have achieved what this does: > >> (for/list ([t '((1 2 3) (4 5 6) (7 8 9) (a b c))]) > (match-define (list x y z) t) >

Re: [racket-users] for/list with in-parallel lists

2017-07-10 Thread Nadeem Abdul Hamid
I'm looking for a general solution. Basically, I thought binding multiple id's would have achieved what this does: > (for/list ([t '((1 2 3) (4 5 6) (7 8 9) (a b c))]) (match-define (list x y z) t) (list x z)) '((1 3) (4 6) (7 9) (a c)) The way the documentation for `for` is worded [3],

Re: [racket-users] for/list with in-parallel lists

2017-07-10 Thread Jon Zeppieri
On Mon, Jul 10, 2017 at 11:40 PM, Nadeem Abdul Hamid wrote: > Given a list of pairs, I'm trying to iterate through the list and bind the > first and second elements of each pair to x and y, respectively, in each > iteration. > > For example, hash sets are a multiple-valued

Re: [racket-users] for/list with in-parallel lists

2017-07-10 Thread Nadeem Abdul Hamid
Given a list of pairs, I'm trying to iterate through the list and bind the first and second elements of each pair to x and y, respectively, in each iteration. For example, hash sets are a multiple-valued sequence[1], so this: (for/list ([(x y) #hash((1 . 2) (3 . 4))]) x) produces: (list 1

Re: [racket-users] for/list with in-parallel lists

2017-07-10 Thread Jon Zeppieri
On Mon, Jul 10, 2017 at 11:02 PM, Nadeem Abdul Hamid wrote: > How come this: >(for/list ([(x y) (in-parallel '(1 2) '(3 4))]) x) > produces > '(1 2) > instead of > '(1 3) > ? You're creating a list of the x values. In the first iteration x is 1, and in the second it's 2.

[racket-users] for/list with in-parallel lists

2017-07-10 Thread Nadeem Abdul Hamid
How come this: (for/list ([(x y) (in-parallel '(1 2) '(3 4))]) x) produces '(1 2) instead of '(1 3) ? Whereas, (sequence-ref (in-parallel '(1 2) '(3 4)) 0) produces 1 3 as I would expect, but am I doing something wrong with for/list? In general, how might one convert a list of