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