Paste: enumerate

Author: mrjbq7
Mode: factor
Date: Tue, 23 Sep 2008 18:51:49
Plain Text |
: enumerate ( seq -- newseq )
    #! Returns a sequence where each element and its index
    -1 swap [ [ 1+ ] dip swap [ 2array ] keep swap ] { } map-as swap drop ;

New Annotation

Summary:
Author:
Mode:
Body: