Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -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]).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement