Paste: lil utils

Author: randy7
Mode: factor
Date: Sat, 7 Feb 2009 15:23:53
Plain Text |
IN: lil-utils
USING: kernel locals math math.ranges sequences splitting ;

: bread-crumbs ( path -- seq ) ! example path: "/boot/home/apps/CDPlayer" - also works with windows paths C:/folder/file
    "/" split dup dup length [1,b] 
    [ head ] with map
    [ "/" join ] map
    [ harvest ] bi@ over first [ CHAR: : = ] contains? [ [ "/" prefix ] bi@ ] unless zip ;

    
:: substr ( from to seq -- substring )
    from seq start [ to seq ] keep start* to length +
    seq subseq ;

    

New Annotation

Summary:
Author:
Mode:
Body: