Sunday, December 21, 2008

Make Sublists in Scheme

A fairly useful function in scheme is to turn a list of elements into a list of list of elements

example: [1,2,3] => [[1], [2], [3]]

(define (make-sublists l)
(map (lambda (x) (list x )) l))

No comments: