]> gitweb.factorcode.org Git - factor.git/blob - extra/furnace/utilities/utilities.factor
4bfbdcd943888c82ff58e331761847cfdced9ee8
[factor.git] / extra / furnace / utilities / utilities.factor
1 ! Copyright (c) 2008 Slava Pestov
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors words kernel sequences splitting ;
4 IN: furnace.utilities
5
6 : word>string ( word -- string )
7     [ vocabulary>> ] [ name>> ] bi ":" swap 3append ;
8
9 : words>strings ( seq -- seq' )
10     [ word>string ] map ;
11
12 ERROR: no-such-word name vocab ;
13
14 : string>word ( string -- word )
15     ":" split1 swap 2dup lookup dup
16     [ 2nip ] [ drop no-such-word ] if ;
17
18 : strings>words ( seq -- seq' )
19     [ string>word ] map ;