SHARE
TWEET

Untitled

a guest Nov 6th, 2012 53 Never
  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]).
RAW Paste Data
Top