Move unicode.data:replace to sequences.lib and refactor it
parent
1c63a443a3
commit
d77c84be19
|
@ -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 ;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue