
Untitled
By: a guest on
Nov 6th, 2012 | syntax:
Erlang | size: 0.29 KB | hits: 44 | expires: Never
-module(fix).
-export([partition/2]).
partition(List, Size) ->
lists:reverse(partition(List, Size, 1, [])).
partition(List, _Size, Idx, Acc) when Idx > length(List) -> Acc;
partition(List, Size, Idx, Acc) ->
partition(List, Size, Idx + Size, [lists:sublist(List, Idx, Size)|Acc]).