]> gitweb.factorcode.org Git - factor.git/blob - basis/quoting/quoting.factor
Resolved merge.
[factor.git] / basis / quoting / quoting.factor
1 ! Copyright (C) 2009 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: sequences math kernel strings combinators.short-circuit ;
4 IN: quoting
5
6 : quote? ( ch -- ? ) "'\"" member? ;
7
8 : quoted? ( str -- ? )
9     {
10         [ length 1 > ]
11         [ first quote? ]
12         [ [ first ] [ last ] bi = ]
13     } 1&& ;
14
15 : unquote ( str -- newstr )
16     dup quoted? [ but-last-slice rest-slice >string ] when ;