From: Daniel Ehrenberg Date: Tue, 3 Mar 2009 18:24:59 +0000 (-0600) Subject: Merge branch 'master' into regexp X-Git-Tag: 0.94~2191^2~64^2~11 X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=177a895c0964aaec251b61d126236fc398ff36cb Merge branch 'master' into regexp Conflicts: basis/xmode/utilities/utilities-tests.factor basis/xmode/utilities/utilities.factor --- 177a895c0964aaec251b61d126236fc398ff36cb diff --cc basis/xmode/utilities/utilities-tests.factor index 0ef221f237,538c8cef6b..338878942b --- a/basis/xmode/utilities/utilities-tests.factor +++ b/basis/xmode/utilities/utilities-tests.factor @@@ -1,10 -1,45 +1,2 @@@ +USING: assocs xmode.utilities tools.test ; IN: xmode.utilities.tests -USING: accessors xmode.utilities tools.test xml xml.data kernel -strings vectors sequences io.files prettyprint assocs -unicode.case ; -- - [ "hi" 3 ] [ - { 1 2 3 4 5 6 7 8 } [ H{ { 3 "hi" } } at ] map-find - ] unit-test -TUPLE: company employees type ; -- - [ f f ] [ - { 1 2 3 4 5 6 7 8 } [ H{ { 11 "hi" } } at ] map-find -: V{ } clone f company boa ; - -: add-employee employees>> push ; - ->name) } { f (>>description) } } - init-from-tag swap add-employee ; - -TAGS> - -\ parse-employee-tag see - -: parse-company-tag - [ - - { { "type" >upper (>>type) } } - init-from-tag dup - ] keep - children>> [ tag? ] filter - [ parse-employee-tag ] with each ; - -[ - T{ company f - V{ - T{ employee f "Joe" "VP Sales" } - T{ employee f "Jane" "CFO" } - } - "PUBLIC" - } -] [ - "vocab:xmode/utilities/test.xml" - file>xml parse-company-tag --] unit-test diff --cc basis/xmode/utilities/utilities.factor index 1b2b4a352f,f3e28bd4da..a7e42877aa --- a/basis/xmode/utilities/utilities.factor +++ b/basis/xmode/utilities/utilities.factor @@@ -5,11 -4,8 +5,6 @@@ IN: xmode.utilitie : implies ( x y -- z ) [ not ] dip or ; inline - : map-find ( seq quot -- result elt ) - [ f ] 2dip - '[ nip @ dup ] find - [ [ drop f ] unless ] dip ; inline -: child-tags ( tag -- seq ) children>> [ tag? ] filter ; -- : tag-init-form ( spec -- quot ) { { [ dup quotation? ] [ [ object get tag get ] prepose ] }