(lambda (zero zero?) (let* ( (Cons (lambda (u v z?) (if (and (null? v) (z? u)) '() (cons u v)))) (Map (lambda (f l z?) (let m ((l l)) (if (null? l) '() (Cons (f (car l)) (m (cdr l)) z?)))))) (lambda (a) (let tr ((a a)) (if (null? a) '() (Cons (Map (lambda (x) (if (null? x) zero (car x))) a zero?) (tr (Map (lambda (x) (if (pair? x) (cdr x) '())) a null?)) null?)))))) ; tests (define tr0 ((fileVal "transpose0") 0 zero?)) (tr0 '((0 0 0 0 0 1) () (0 0) (0 1 0))) ; => (() (0 0 0 1) () () () (1)) (tr0 '((0 0) (0 1 0))) ; => (() (0 1))