Skip to content

Instantly share code, notes, and snippets.

@minikomi
Last active December 24, 2015 15:29
Show Gist options
  • Save minikomi/6820847 to your computer and use it in GitHub Desktop.
Save minikomi/6820847 to your computer and use it in GitHub Desktop.
(define groups-of
(case-lambda
[(n lst) (groups-of n n lst)]
[(n step lst)
(cond
[(empty? lst) '()]
[(< (length lst) n) (list lst)]
[else (cons (take lst n) (groups-of n step (drop lst step)))])]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment