That is exactly the function I was trying to find or write. Thanks! 12.05.2016, 01:04, "Ryan Culpepper" <ry...@ccs.neu.edu>: > You might find this function helpful (from the implementation of in-query): > > (define (in-list/vector->values vs) > (make-do-sequence > (lambda () > (values (lambda (p) (vector->values (car p))) > cdr > vs > pair? #f #f)))) > > Ryan > > On 05/04/2016 09:46 AM, Denis Fadeev wrote: >> That's better than vector-ref: >> >> ,@(for/list (((some-string some-list-of-vectors) (in-query ... #:group ...) >> `(h1 ,(~a some-string)) >> ,@(for/list (((some-vector) some-list-of-vectors)) >> (match-define (vector some-string2 some-string3) >> some-vector) >> `(p ,(~a some-string2) >> >> I would obviously preferred something like: >> >> ,@(for/list (((some-string some-list-of-vectors) (in-query ... #:group ...) >> `(h1 ,(~a some-string)) >> ,@(for/list (((some-string2 some-string3) (MAGIC! >> some-list-of-vectors))) >> `(p ,(~a some-string2) >> >> среда, 4 мая 2016 г., 13:00:22 UTC+5 пользователь Denis Fadeev написал: >>> Hi, >>> >>> I'm querying a DB using in-query with #:group. For every iteration it >>> returns multiple values, which i bind to some-string and >>> some-list-of-vectors. Next, I iterate through some-list-of-vectors, but >>> some-list-of-vectors is no sequence, so I can't bind multiple values like I >>> did in the first for/list. >>> >>> ,@(for/list (((some-string some-list-of-vectors) (in-query ... #:group ...) >>> `(h1 ,(~a some-string)) >>> ,@(for/list (((some-string2 some-string3) some-list-of-vectors)) >>> `(p ,(~a some-string2) >>> >>> 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? I just >>> really like the concise way of binding multiple values inside for/list. Of >>> course, i can vector-ref in the second for/list, but that's not as nice. >>> I'm using it to populate an xexpr. Maybe, there is a better way to do it? >>> >>> Any help would be greatly appreciated! >>> >>> Denis.
-- 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.