Paste: seq or text seperating

Author: randy7
Mode: factor
Date: Mon, 9 Feb 2009 17:59:53
Plain Text |
IN: ...
USING: kernel arrays math sequences ;

: (match-min) ( seq item -- min ) [ > ] curry filter first ;

: close-match ( seq1 seq2 -- seq3 )
    swap [ swap [ (match-min) ] keep swap 2array ] curry map ;

: complement ( seq -- seq' )
    [ [ second ] map 0 prefix ] [ [ first ] map ] bi zip ;


! I plan to use this for seperating text from tags, 
! manipulate the text, and rebuild the document.
 



Annotation: fix!

Author: randy
Mode: factor
Date: Thu, 12 Feb 2009 08:27:39
Plain Text |
: (match-min) ( seq item -- min ) [ > ] curry filter dup empty? [ drop f ] [ first ] if ;

: close-match ( seq1 seq2 -- seq3 )
    [ swap [ (match-min) ] keep swap 2array ] curry map ;

New Annotation

Summary:
Author:
Mode:
Body: