Paste: nsplit

Author: tylerg
Mode: factor
Date: Wed, 9 Sep 2009 20:12:22
Plain Text |
! hopefully this will make its way into the sequences vocabulary

! splits a sequence into a sequence of sequences of length n, with any remaining elements appended to the end

! feel free to post improvements

:: nsplit ( seq n -- seq )
  seq [ dup length n >= ] [ n cut swap ] produce
  swap append ;

Annotation: update

Author: tylerg
Mode: text
Date: Wed, 9 Sep 2009 20:30:32
Plain Text |
I have finally found the "groups" vocabulary, which provides this functionality and more.  

New Annotation

Summary:
Author:
Mode:
Body: