Skip to content

Instantly share code, notes, and snippets.

@valvallow
Created July 21, 2010 04:23
cars+cdrs, scheme, gauche
(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)))))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment