factor/extra/lsys/strings/strings.factor

15 lines
420 B
Factor
Raw Normal View History

2007-09-20 18:09:08 -04:00
2008-03-29 00:00:20 -04:00
USING: kernel sequences math combinators.lib ;
2007-09-20 18:09:08 -04:00
IN: lsys.strings
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: has-param? ( slice -- ? ) { [ length 1 > ] [ second CHAR: ( = ] } <-&& ;
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 ;