Paste: replacing booleans with string values
Author: | otoburb |
Mode: | factor |
Date: | Wed, 18 May 2011 04:15:17 |
Plain Text |
H{
{ "value1" t }
{ "value2" f }
{ "value3" 3 }
}
: boolean-string-substitute ( assoc -- assoc' )
[ dup [ t = [ drop "True" ] when ] [ f = [ drop "False" ] when ] bi ] assoc-map ;
Author: | noam |
Mode: | factor |
Date: | Wed, 18 May 2011 11:59:51 |
Plain Text |
: bool>string ( ? -- str )
{
{ t [ "True" ] }
{ f [ "False" ] }
[ ]
} case ;
: boolean-string-substitute ( assoc -- assoc' )
[ bool>string ] assoc-map ;
New Annotation