[racket] Style. for/fold for/list for/lists

From: Roman Klochkov (kalimehtar at mail.ru)
Date: Sat Jan 18 06:25:10 EST 2014

 Where can I find style guide for these

for/lists:

I have to duplicate values names:

(define-values ([(desc-args lengths add-data)
              (for/lists (desc-args lengths add-data) ([arg (in-list %args)])
                          ....))  is it ok? Or better 
(define-values ([(desc-args lengths add-data)
   (for/lists (a b c) (...) ...))

?

for/fold has no "return" clause. So I have to do
(call-with-values
  (for/fold (acc1 acc2 sum) (...) ...)
  (lambda (acc1 acc2 sum) (reverse acc1) (reverse acc2) sum))

And for/list doesn't allow to add several items to resulting list in one round.
Even with for/fold it gives

(reverse 
  (for/fold (acc) ([item (in-list list)])
     (values (cons (get-val1 item)
                              (cons (get-val2 item) acc)))))

Awful, especially for reading.

It is clumsy and unobvious.
In Common Lisp iterate I could do
(iter (...)
   (collect (foo) into acc1)
   (collect (bar) into acc2)
   (summing ... into sum)
   (finally (return acc1 acc2 sum)))

http://common-lisp.net/project/iterate/doc/index.html

Is there something similar?

-- 
Roman Klochkov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140118/58c0720f/attachment.html>

Posted on the users mailing list.