Advertisement
Guest User

Untitled

a guest
Nov 6th, 2012
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Erlang 0.29 KB | None | 0 0
  1. -module(fix).
  2. -export([partition/2]).
  3.  
  4. partition(List, Size) ->
  5.     lists:reverse(partition(List, Size, 1, [])).
  6.  
  7. partition(List, _Size, Idx, Acc) when Idx > length(List) -> Acc;
  8. partition(List, Size, Idx, Acc) ->
  9.     partition(List, Size, Idx + Size, [lists:sublist(List, Idx, Size)|Acc]).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement