Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (my-partition-randomly '(a b c d e f g h i j k l) 4)
- '((a b c) (d) (e f g h) (i j k) (l))
- (defun my-partition-randomly (list max-length) ""
- (let ((result '()))
- (while list
- (push (seq-take-while (lambda (x) x)
- (map 'list
- (lambda (x) (pop list))
- (number-sequence 1 (+ 1 (random max-length)))))
- result))
- (reverse result)))
Add Comment
Please, Sign In to add comment