Skip to content

Instantly share code, notes, and snippets.

@lyninx
lyninx / partition.ex
Last active July 8, 2020 19:41
elixir function for splitting lists into equal sized chunks, written using recursion
# `partition/2` splits a list into smaller lists of a given size, using recursion!
#
# usage:
# list = [:one, :two, :three, :four, :five]
# partition(list, 2)
# > [[:one, :two], [:three, :four], [:five]]
def partition(list, partition_size)
when is_list(list)
and is_integer(partition_size)
<html>
<body>
<script type="text/javascript" src="http://code.jquery.com/jquery-2.2.0.min.js"></script>
<script type="text/javascript" src="shopicruit.js"></script>
</body>
</html>