On Mon, Jul 10, 2017 at 11:40 PM, Nadeem Abdul Hamid <nad...@acm.org> 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 sequence[1], so this: > (for/list ([(x y) #hash((1 . 2) (3 . 4))]) x) > produces: > (list 1 3) > > i.e. here x gets bound to 1 in the first iteration and 3 in the second. I > would like something analogous for a list of pairs, i.e. replacing #hash > with ' : > (for/list ([(x y) '((1 . 2) (3 . 4))]) x) > except that lists are a by default a single-valued sequence[2]. > >
in-dict will work for lists of pairs, like the ones in this example (and it will work for hashes, as well), but it won't work for lists of lists, like the examples in your previous message. Are lists of pairs all you need to handle, or do you need something more general? -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.