diff --git a/extra/sequences/lib/lib.factor b/extra/sequences/lib/lib.factor index 1beec90b75..4c0ea04f24 100755 --- a/extra/sequences/lib/lib.factor +++ b/extra/sequences/lib/lib.factor @@ -205,3 +205,6 @@ PRIVATE> : attempt-each ( seq quot -- result ) (each) iterate-prep (attempt-each-integer) ; inline + +: replace ( seq old new -- newseq ) + [ pick pick = [ 2nip ] [ 2drop ] if ] 2curry map ; diff --git a/extra/tools/disassembler/disassembler.factor b/extra/tools/disassembler/disassembler.factor index b74b2795cf..641eae90c2 100644 --- a/extra/tools/disassembler/disassembler.factor +++ b/extra/tools/disassembler/disassembler.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: io.files io words alien kernel math.parser alien.syntax io.launcher system assocs arrays sequences namespaces qualified -regexp system math ; +regexp system math sequences.lib ; QUALIFIED: unix IN: tools.disassembler @@ -36,7 +36,7 @@ M: pair make-disassemble-cmd R/ 0x.*:.*/ matches? ; : tabs>spaces ( str -- str' ) - [ dup CHAR: \t = [ drop CHAR: \s ] when ] map ; + CHAR: \t CHAR: \s replace ; : disassemble ( word -- ) make-disassemble-cmd run-gdb diff --git a/extra/unicode/data/data.factor b/extra/unicode/data/data.factor index 3af3d927d7..419d3bcefd 100644 --- a/extra/unicode/data/data.factor +++ b/extra/unicode/data/data.factor @@ -1,6 +1,7 @@ -USING: assocs math kernel sequences io.files hashtables -quotations splitting arrays math.parser combinators.lib hash2 -byte-arrays words namespaces words compiler.units parser ; +USING: assocs math kernel sequences sequences.lib io.files +hashtables quotations splitting arrays math.parser +combinators.lib hash2 byte-arrays words namespaces words +compiler.units parser ; IN: unicode.data << @@ -93,9 +94,6 @@ IN: unicode.data : ascii-lower ( string -- lower ) [ dup CHAR: A CHAR: Z between? [ HEX: 20 + ] when ] map ; -: replace ( seq old new -- newseq ) - swap rot [ 2dup = [ drop over ] when ] map 2nip ; - : process-names ( data -- names-hash ) 1 swap (process-data) [ ascii-lower CHAR: \s CHAR: - replace swap ] assoc-map