Author: | otoburb |
---|---|
Mode: | factor |
Date: | Wed, 18 May 2011 04:15:17 |
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 |
! you can squeeze it to one word, but usually it's cleaner this way : bool>string ( ? -- str ) { { t [ "True" ] } { f [ "False" ] } [ ] } case ; : boolean-string-substitute ( assoc -- assoc' ) [ bool>string ] assoc-map ;