"H{ } substitute" is faster than "{ } substitute".
parent
d5ef0e046a
commit
4f260ab9bd
|
@ -9,7 +9,7 @@ IN: colors.constants
|
|||
: parse-color ( line -- name color )
|
||||
first4
|
||||
[ [ string>number 255 /f ] tri@ 1.0 <rgba> ] dip
|
||||
[ blank? ] trim-head { { CHAR: \s CHAR: - } } substitute swap ;
|
||||
[ blank? ] trim-head H{ { CHAR: \s CHAR: - } } substitute swap ;
|
||||
|
||||
: parse-colors ( lines -- assoc )
|
||||
[ "!" head? not ] filter
|
||||
|
|
|
@ -77,7 +77,8 @@ M: did-not-fail summary drop "Did not fail" ;
|
|||
[ { } quot with-datastack drop did-not-fail t ] [ drop f f ] recover ;
|
||||
|
||||
: experiment-title ( word -- string )
|
||||
"(" ?head drop ")" ?tail drop { { CHAR: - CHAR: \s } } substitute >title ;
|
||||
"(" ?head drop ")" ?tail drop
|
||||
H{ { CHAR: - CHAR: \s } } substitute >title ;
|
||||
|
||||
MACRO: <experiment> ( word -- )
|
||||
[ stack-effect in>> length dup ]
|
||||
|
|
|
@ -120,7 +120,7 @@ SYMBOL: dpi
|
|||
: escape-nulls ( str -- str' )
|
||||
#! Replace nulls with something else since Pango uses null-terminated
|
||||
#! strings
|
||||
{ { 0 CHAR: zero-width-no-break-space } } substitute ;
|
||||
H{ { 0 CHAR: zero-width-no-break-space } } substitute ;
|
||||
|
||||
: unpack-selection ( layout string/selection -- layout )
|
||||
dup selection? [
|
||||
|
|
|
@ -17,7 +17,7 @@ SLOT: history
|
|||
|
||||
: history-list ( interactor -- alist )
|
||||
history>> elements>>
|
||||
[ dup string>> { { CHAR: \n CHAR: \s } } substitute ] { } map>assoc
|
||||
[ dup string>> H{ { CHAR: \n CHAR: \s } } substitute ] { } map>assoc
|
||||
<reversed> ;
|
||||
|
||||
: history-completions ( short interactor -- seq )
|
||||
|
|
|
@ -158,7 +158,7 @@ PRIVATE>
|
|||
|
||||
: process-names ( data -- names-hash )
|
||||
1 swap (process-data) [
|
||||
>lower { { CHAR: \s CHAR: - } } substitute swap
|
||||
>lower H{ { CHAR: \s CHAR: - } } substitute swap
|
||||
] H{ } assoc-map-as ;
|
||||
|
||||
: multihex ( hexstring -- string )
|
||||
|
|
|
@ -42,7 +42,7 @@ M: string vocab-path ( string -- path/f )
|
|||
PRIVATE>
|
||||
|
||||
: vocab-dir ( vocab -- dir )
|
||||
vocab-name { { CHAR: . CHAR: / } } substitute ;
|
||||
vocab-name H{ { CHAR: . CHAR: / } } substitute ;
|
||||
|
||||
: append-vocab-dir ( vocab str/f -- path )
|
||||
[ vocab-name "." split ] dip
|
||||
|
|
|
@ -5,7 +5,7 @@ mason.config bootstrap.image assocs ;
|
|||
IN: mason.platform
|
||||
|
||||
: (platform) ( os cpu -- string )
|
||||
{ { CHAR: . CHAR: - } } substitute "-" glue ;
|
||||
H{ { CHAR: . CHAR: - } } substitute "-" glue ;
|
||||
|
||||
: platform ( -- string )
|
||||
target-os get name>> target-cpu get name>> (platform)
|
||||
|
|
|
@ -10,7 +10,7 @@ XML-NS: sodipodi-name http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd
|
|||
XML-NS: inkscape-name http://www.inkscape.org/namespaces/inkscape
|
||||
|
||||
: svg-string>number ( string -- number )
|
||||
{ { CHAR: E CHAR: e } } substitute "e" split1
|
||||
H{ { CHAR: E CHAR: e } } substitute "e" split1
|
||||
[ string>number ] [ [ string>number 10^ ] [ 1 ] if* ] bi* *
|
||||
>float ;
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ PRIVATE>
|
|||
add-mixin-instance define-class-tuple ;
|
||||
|
||||
:: define-c++-method ( class-name generic name types effect virtual -- )
|
||||
[ name % "_" % class-name { { CHAR: : CHAR: _ } } substitute % ] "" make :> name'
|
||||
[ name % "_" % class-name H{ { CHAR: : CHAR: _ } } substitute % ] "" make :> name'
|
||||
effect [ in>> "self" suffix ] [ out>> ] bi <effect> :> effect'
|
||||
types class-name "*" append suffix :> types'
|
||||
effect in>> "," join :> args
|
||||
|
|
|
@ -7,7 +7,7 @@ IN: alien.inline.types
|
|||
|
||||
: cify-type ( str -- str' )
|
||||
dup word? [ name>> ] when
|
||||
{ { CHAR: - CHAR: space } } substitute ;
|
||||
H{ { CHAR: - CHAR: space } } substitute ;
|
||||
|
||||
: factorize-type ( str -- str' )
|
||||
cify-type
|
||||
|
|
|
@ -41,7 +41,7 @@ PRIVATE>
|
|||
name c-type fields>> [
|
||||
class swap
|
||||
{
|
||||
[ name>> { { CHAR: space CHAR: - } } substitute ]
|
||||
[ name>> H{ { CHAR: space CHAR: - } } substitute ]
|
||||
[ type>> ] [ reader>> ] [ writer>> ]
|
||||
} cleave define-struct-accessors
|
||||
] each ;
|
||||
|
|
Loading…
Reference in New Issue