Paste: cherry pick a subsequence

Author: sconcrete
Mode: factor
Date: Tue, 20 Jan 2009 20:04:31
Plain Text |
! Create a subsequence from 'seq' by only selecting elements
! whose index is in 'indices'.
: pick-indices ( seq indices -- subseq )
    [ [ [ swap nth , ] curry ] map cleave ] { } make ;

Annotation: nths

Author: me
Mode: factor
Date: Tue, 20 Jan 2009 21:20:00
Plain Text |
sequences:nths:

USING: kernel ;
IN: sequences

: nths ( indices  seq -- seq' ) [ nth ] curry map ;

New Annotation

Summary:
Author:
Mode:
Body: