Paste: Retrieve indexes

Author: Muzzleflash
Mode: factor
Date: Fri, 20 Feb 2009 17:47:43
Plain Text |
USING: kernel math sequences namespaces ;
IN: search

: every-index ( seq ch -- index-seq ) swap   ! swap to ch seq
                                      SYMBOL: i 0 i set { } ! index reached
                                      2over i get swap  ! ch i seq -- stack structure
                                      index-from
                                      [ 1 + dup i set append 2over i get swap ]  ! if true
                                      [ drop [ 2drop ] dip ] ! if false
                                      while ;

New Annotation

Summary:
Author:
Mode:
Body: