On May 4, 2016, at 6:46 AM, Denis Fadeev <[email protected]> wrote:
>
>>
>> How can I bind values in the second for/list the same way I did in the first
>> for list. Can I convert some-list-of-vectors to a sequence?
You can use `for*/list` with `in-value` to avoid `match-define`:
;;;;;;;;;
#lang racket
(define vecs (make-list 100 (vector "str1" "str2")))
(for*/list ([vec (in-list vecs)]
[val (in-value (vector-ref vec 0))])
val)
;;;;;;;;;
Or, if you restructure your query to create two parallel vectors of length n
(rather than a list of n vectors of length 2), you can use `in-parallel` to
bind two values at a time:
;;;;;;;;;;;
#lang racket
(define vec1 (make-vector 100 "vec1-str"))
(define vec2 (make-vector 100 "vec2-str"))
(for/list ([(some-string2 some-string3) (in-parallel vec1 vec2)])
(list some-string2 some-string3))
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.