factor/unmaintained/lsys/strings/strings.factor

15 lines
445 B
Factor
Raw Normal View History

2007-09-20 18:09:08 -04:00
USING: kernel sequences math combinators.lib combinators.short-circuit ;
2007-09-20 18:09:08 -04:00
IN: lsys.strings
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2008-06-10 10:07:45 -04:00
: has-param? ( slice -- ? ) { [ length 1 > ] [ second CHAR: ( = ] } 1&& ;
2007-09-20 18:09:08 -04:00
: next+rest ( slice -- next rest ) [ 1 head ] [ 1 tail-slice ] bi ;
2007-09-20 18:09:08 -04:00
: index-rest ( slice -- i ) CHAR: ) swap index 1+ ;
2007-09-20 18:09:08 -04:00
: next+rest* ( slice -- next rest ) dup index-rest [ head ] [ tail-slice ] 2bi ;