2010/07/21

cars+cdrs

カンニングしつつ書いてみた。
(use srfi-8)
(define (cars+cdrs ls . rest-lists)
(let1 lists (cons ls rest-lists)
(let loop ((lists lists))
(if (null? lists)
(values '() '())
(receive (ls rest-lists)(car+cdr lists)
(receive (a d)(car+cdr ls)
(receive (cars cdrs)(loop rest-lists)
(values (cons a cars)(cons d cdrs)))))))))
view raw cars+cars.scm hosted with ❤ by GitHub


プログラミングGauche

0 件のコメント:

コメントを投稿