9 lines
283 B
Text
9 lines
283 B
Text
: haystack(*) ['rosetta 'code 'search 'a 'list 'lang5 'code] find-index ;
|
|
: find-index
|
|
2dup eq length iota swap select swap drop
|
|
length if swap drop
|
|
else drop " is not in haystack" 2 compress "" join
|
|
then ;
|
|
: ==>search apply ;
|
|
|
|
['hello 'code] 'haystack ==>search .
|