over push -> suffix!, over push-all -> append!

db4
Doug Coleman 2009-10-28 15:29:01 -05:00
parent bd13e018dd
commit 93de179c2f
23 changed files with 42 additions and 42 deletions

View File

@ -37,7 +37,7 @@ ERROR: no-such-symbol name library ;
2dup load-library dlsym [ 2nip ] [ no-such-symbol ] if* ; 2dup load-library dlsym [ 2nip ] [ no-such-symbol ] if* ;
SYNTAX: &: SYNTAX: &:
scan "c-library" get '[ _ _ address-of ] over push-all ; scan "c-library" get '[ _ _ address-of ] append! ;
: global-quot ( type word -- quot ) : global-quot ( type word -- quot )
name>> "c-library" get '[ _ _ address-of 0 ] name>> "c-library" get '[ _ _ address-of 0 ]

View File

@ -350,7 +350,7 @@ PRIVATE>
: parse-struct-slots ( slots -- slots' more? ) : parse-struct-slots ( slots -- slots' more? )
scan { scan {
{ ";" [ f ] } { ";" [ f ] }
{ "{" [ parse-struct-slot over push t ] } { "{" [ parse-struct-slot suffix! t ] }
{ f [ unexpected-eof ] } { f [ unexpected-eof ] }
[ invalid-struct-slot ] [ invalid-struct-slot ]
} case ; } case ;
@ -378,7 +378,7 @@ SYNTAX: S@
: parse-struct-slot` ( accum -- accum ) : parse-struct-slot` ( accum -- accum )
scan-string-param scan-c-type` \ } parse-until scan-string-param scan-c-type` \ } parse-until
[ <struct-slot-spec> over push ] 3curry over push-all ; [ <struct-slot-spec> suffix! ] 3curry append! ;
: parse-struct-slots` ( accum -- accum more? ) : parse-struct-slots` ( accum -- accum more? )
scan { scan {
@ -390,9 +390,9 @@ PRIVATE>
FUNCTOR-SYNTAX: STRUCT: FUNCTOR-SYNTAX: STRUCT:
scan-param suffix! scan-param suffix!
[ 8 <vector> ] over push-all [ 8 <vector> ] append!
[ parse-struct-slots` ] [ ] while [ parse-struct-slots` ] [ ] while
[ >array define-struct-class ] over push-all ; [ >array define-struct-class ] append! ;
USING: vocabs vocabs.loader ; USING: vocabs vocabs.loader ;

View File

@ -53,4 +53,4 @@ M: callable deep-fry
M: object deep-fry , ; M: object deep-fry , ;
SYNTAX: '[ parse-quotation fry over push-all ; SYNTAX: '[ parse-quotation fry append! ;

View File

@ -43,7 +43,7 @@ M: object (fake-quotations>) , ;
: parse-definition* ( accum -- accum ) : parse-definition* ( accum -- accum )
parse-definition >fake-quotations suffix! parse-definition >fake-quotations suffix!
[ fake-quotations> first ] over push-all ; [ fake-quotations> first ] append! ;
: parse-declared* ( accum -- accum ) : parse-declared* ( accum -- accum )
complete-effect complete-effect
@ -74,7 +74,7 @@ FUNCTOR-SYNTAX: MIXIN:
FUNCTOR-SYNTAX: M: FUNCTOR-SYNTAX: M:
scan-param suffix! scan-param suffix!
scan-param suffix! scan-param suffix!
[ create-method-in dup method-body set ] over push-all [ create-method-in dup method-body set ] append!
parse-definition* parse-definition*
\ define* suffix! ; \ define* suffix! ;
@ -82,7 +82,7 @@ FUNCTOR-SYNTAX: C:
scan-param suffix! scan-param suffix!
scan-param suffix! scan-param suffix!
complete-effect complete-effect
[ [ [ boa ] curry ] over push-all ] dip suffix! [ [ [ boa ] curry ] append! ] dip suffix!
\ define-declared* suffix! ; \ define-declared* suffix! ;
FUNCTOR-SYNTAX: : FUNCTOR-SYNTAX: :
@ -114,7 +114,7 @@ FUNCTOR-SYNTAX: MACRO:
parse-declared* parse-declared*
\ define-macro suffix! ; \ define-macro suffix! ;
FUNCTOR-SYNTAX: inline [ word make-inline ] over push-all ; FUNCTOR-SYNTAX: inline [ word make-inline ] append! ;
FUNCTOR-SYNTAX: call-next-method T{ fake-call-next-method } suffix! ; FUNCTOR-SYNTAX: call-next-method T{ fake-call-next-method } suffix! ;

View File

@ -40,4 +40,4 @@ MACRO: interpolate ( string -- )
SYNTAX: I[ SYNTAX: I[
"]I" parse-multiline-string "]I" parse-multiline-string
interpolate-locals over push-all ; interpolate-locals append! ;

View File

@ -53,7 +53,7 @@ M: input-port stream-read-partial ( max stream -- byte-array/f )
: read-loop ( count port accum -- ) : read-loop ( count port accum -- )
pick over length - dup 0 > [ pick over length - dup 0 > [
pick read-step dup [ pick read-step dup [
over push-all read-loop append! read-loop
] [ ] [
2drop 2drop 2drop 2drop
] if ] if
@ -78,7 +78,7 @@ M: input-port stream-read
: read-until-loop ( seps port buf -- separator/f ) : read-until-loop ( seps port buf -- separator/f )
2over read-until-step over [ 2over read-until-step over [
[ over push-all ] dip dup [ [ append! ] dip dup [
[ 3drop ] dip [ 3drop ] dip
] [ ] [
drop read-until-loop drop read-until-loop

View File

@ -9,13 +9,13 @@ SYNTAX: :>
scan locals get [ :>-outside-lambda-error ] unless* scan locals get [ :>-outside-lambda-error ] unless*
[ make-local ] bind <def> suffix! ; [ make-local ] bind <def> suffix! ;
SYNTAX: [| parse-lambda over push-all ; SYNTAX: [| parse-lambda append! ;
SYNTAX: [let parse-let over push-all ; SYNTAX: [let parse-let append! ;
SYNTAX: [let* parse-let* over push-all ; SYNTAX: [let* parse-let* append! ;
SYNTAX: [wlet parse-wlet over push-all ; SYNTAX: [wlet parse-wlet append! ;
SYNTAX: :: (::) define-declared ; SYNTAX: :: (::) define-declared ;

View File

@ -40,7 +40,7 @@ M: just-parser (compile) ( parser -- quot )
<PRIVATE <PRIVATE
: flatten-vectors ( pair -- vector ) : flatten-vectors ( pair -- vector )
first2 over push-all ; first2 append! ;
PRIVATE> PRIVATE>

View File

@ -634,7 +634,7 @@ SYNTAX: PEG:
word swap effect define-declared word swap effect define-declared
] ]
] with-compilation-unit ] with-compilation-unit
] over push-all ] append!
] ; ] ;
USING: vocabs vocabs.loader ; USING: vocabs vocabs.loader ;

View File

@ -19,7 +19,7 @@ M: object random-bytes* ( n tuple -- byte-array )
[ pick '[ _ random-32* 4 >le _ push-all ] times ] [ pick '[ _ random-32* 4 >le _ push-all ] times ]
[ [
over zero? over zero?
[ 2drop ] [ random-32* 4 >le swap head over push-all ] if [ 2drop ] [ random-32* 4 >le swap head append! ] if
] bi-curry bi* ; ] bi-curry bi* ;
M: object random-32* ( tuple -- r ) 4 swap random-bytes* le> ; M: object random-32* ( tuple -- r ) 4 swap random-bytes* le> ;

View File

@ -43,7 +43,7 @@ MEMO: standard-rule-set ( id -- ruleset )
: ?push-all ( seq1 seq2 -- seq1+seq2 ) : ?push-all ( seq1 seq2 -- seq1+seq2 )
[ [
over [ [ V{ } like ] dip over push-all ] [ nip ] if over [ [ V{ } like ] dip append! ] [ nip ] if
] when* ; ] when* ;
: rule-set-no-word-sep* ( ruleset -- str ) : rule-set-no-word-sep* ( ruleset -- str )

View File

@ -35,4 +35,4 @@ ERROR: stack-effect-omits-dashes effect ;
"(" expect ")" parse-effect ; "(" expect ")" parse-effect ;
: parse-call( ( accum word -- accum ) : parse-call( ( accum word -- accum )
[ ")" parse-effect ] dip 2array over push-all ; [ ")" parse-effect ] dip 2array append! ;

View File

@ -741,7 +741,7 @@ PRIVATE>
: concat-as ( seq exemplar -- newseq ) : concat-as ( seq exemplar -- newseq )
swap [ { } ] [ swap [ { } ] [
[ sum-lengths over new-resizable ] keep [ sum-lengths over new-resizable ] keep
[ over push-all ] each [ append! ] each
] if-empty swap like ; ] if-empty swap like ;
: concat ( seq -- newseq ) : concat ( seq -- newseq )

View File

@ -4,10 +4,10 @@ SYMBOL: |
! Selective Binding ! Selective Binding
: delayed-bind-with ( vars quot -- quot' ) '[ _ dup [ get ] map zip >hashtable [ _ bind ] curry ] ; : delayed-bind-with ( vars quot -- quot' ) '[ _ dup [ get ] map zip >hashtable [ _ bind ] curry ] ;
SYNTAX: C[ | parse-until parse-quotation delayed-bind-with over push-all ; SYNTAX: C[ | parse-until parse-quotation delayed-bind-with append! ;
! Common ones ! Common ones
SYNTAX: DIR[ parse-quotation { current-directory } swap delayed-bind-with over push-all ; SYNTAX: DIR[ parse-quotation { current-directory } swap delayed-bind-with append! ;
! Namespace Binding ! Namespace Binding
: bind-to-namespace ( quot -- quot' ) '[ namespace [ _ bind ] curry ] ; : bind-to-namespace ( quot -- quot' ) '[ namespace [ _ bind ] curry ] ;
SYNTAX: NS[ parse-quotation bind-to-namespace over push-all ; SYNTAX: NS[ parse-quotation bind-to-namespace append! ;

View File

@ -13,4 +13,4 @@ SYNTAX: FONT: \ ; parse-until {
[ [ italic = ] find nip [ >>italic? ] install ] [ [ italic = ] find nip [ >>italic? ] install ]
[ [ bold = ] find nip [ >>bold? ] install ] [ [ bold = ] find nip [ >>bold? ] install ]
[ [ fontname? ] find nip [ >>name* ] install ] [ [ fontname? ] find nip [ >>name* ] install ]
} cleave 4array concat '[ dup font>> @ drop ] over push-all ; } cleave 4array concat '[ dup font>> @ drop ] append! ;

View File

@ -8,6 +8,6 @@ IN: fries
[ unclip-last [ [ spin 1array glue ] reduce-r ] 2curry ] [ unclip-last [ [ spin 1array glue ] reduce-r ] 2curry ]
[ length 1 - 1 <effect> [ call-effect ] 2curry ] bi ; [ length 1 - 1 <effect> [ call-effect ] 2curry ] bi ;
SYNTAX: i" parse-string rest "_" str-fry over push-all ; SYNTAX: i" parse-string rest "_" str-fry append! ;
SYNTAX: i{ \ } parse-until >array { _ } gen-fry over push-all ; SYNTAX: i{ \ } parse-until >array { _ } gen-fry append! ;
SYNTAX: iV{ \ } parse-until >vector V{ _ } gen-fry over push-all ; SYNTAX: iV{ \ } parse-until >vector V{ _ } gen-fry append! ;

View File

@ -107,7 +107,7 @@ UNIFORM-TUPLE: loading-uniforms
[ [
numbers { numbers {
{ [ dup length 5 = ] [ <bunny-vertex> pick push ] } { [ dup length 5 = ] [ <bunny-vertex> pick push ] }
{ [ dup first 3 = ] [ rest over push-all ] } { [ dup first 3 = ] [ rest append! ] }
[ drop ] [ drop ]
} cond } cond
] each-line-tokens ; inline ] each-line-tokens ; inline

View File

@ -93,4 +93,4 @@ PRIVATE>
SYNTAX: [infix| SYNTAX: [infix|
"|" parse-bindings "infix]" parse-infix-locals <let> "|" parse-bindings "infix]" parse-infix-locals <let>
?rewrite-closures over push-all ; ?rewrite-closures append! ;

View File

@ -24,7 +24,7 @@ IN: project-euler.017
! -------- ! --------
: euler017 ( -- answer ) : euler017 ( -- answer )
1000 [1,b] SBUF" " clone [ number>text over push-all ] reduce [ Letter? ] count ; 1000 [1,b] SBUF" " clone [ number>text append! ] reduce [ Letter? ] count ;
! [ euler017 ] 100 ave-time ! [ euler017 ] 100 ave-time
! 15 ms ave run time - 1.71 SD (100 trials) ! 15 ms ave run time - 1.71 SD (100 trials)

View File

@ -39,7 +39,7 @@ IN: project-euler.038
pick length 8 > [ pick length 8 > [
2drop 10 digits>integer 2drop 10 digits>integer
] [ ] [
[ * number>digits over push-all ] 2keep 1 + (concat-product) [ * number>digits append! ] 2keep 1 + (concat-product)
] if ; ] if ;
: concat-product ( n -- m ) : concat-product ( n -- m )

View File

@ -28,7 +28,7 @@ IN: project-euler.040
: (concat-upto) ( n limit str -- str ) : (concat-upto) ( n limit str -- str )
2dup length > [ 2dup length > [
pick number>string over push-all rot 1 + -rot (concat-upto) pick number>string append! [ 1 + ] 2dip (concat-upto)
] [ ] [
2nip 2nip
] if ; ] if ;

View File

@ -59,9 +59,9 @@ M: model-field model-changed 2dup model*>> =
: <slider> ( init page min max step -- slider ) <range> horizontal slider:<slider> ; : <slider> ( init page min max step -- slider ) <range> horizontal slider:<slider> ;
: image-prep ( -- image ) scan current-vocab name>> "vocab:" "/icons/" surround ".tiff" surround <image-name> dup cached-image drop ; : image-prep ( -- image ) scan current-vocab name>> "vocab:" "/icons/" surround ".tiff" surround <image-name> dup cached-image drop ;
SYNTAX: IMG-MODEL-BTN: image-prep [ <model-btn> ] curry over push-all ; SYNTAX: IMG-MODEL-BTN: image-prep [ <model-btn> ] curry append! ;
SYNTAX: IMG-BTN: image-prep [ swap <button> ] curry over push-all ; SYNTAX: IMG-BTN: image-prep [ swap <button> ] curry append! ;
GENERIC: output-model ( gadget -- model ) GENERIC: output-model ( gadget -- model )
M: gadget output-model model>> ; M: gadget output-model model>> ;

View File

@ -26,8 +26,8 @@ DEFER: with-interface
: insertion-quot ( quot -- quot' ) make:building get [ [ placeholder? ] find-last nip [ <placeholder> dup , ] unless* : insertion-quot ( quot -- quot' ) make:building get [ [ placeholder? ] find-last nip [ <placeholder> dup , ] unless*
templates get spin '[ [ _ templates set _ , @ ] with-interface ] ] when* ; templates get spin '[ [ _ templates set _ , @ ] with-interface ] ] when* ;
SYNTAX: ,% scan string>number [ <layout> , ] curry over push-all ; SYNTAX: ,% scan string>number [ <layout> , ] curry append! ;
SYNTAX: ->% scan string>number '[ [ _ <layout> , ] [ output-model ] bi ] over push-all ; SYNTAX: ->% scan string>number '[ [ _ <layout> , ] [ output-model ] bi ] append! ;
GENERIC: -> ( uiitem -- model ) GENERIC: -> ( uiitem -- model )
M: gadget -> dup , output-model ; M: gadget -> dup , output-model ;
@ -55,7 +55,7 @@ M: model -> dup , ;
ERROR: not-in-template word ; ERROR: not-in-template word ;
SYNTAX: $ CREATE-WORD dup SYNTAX: $ CREATE-WORD dup
[ [ dup templates get at [ nip , ] [ not-in-template ] if* ] curry (( -- )) define-declared "$" expect ] [ [ dup templates get at [ nip , ] [ not-in-template ] if* ] curry (( -- )) define-declared "$" expect ]
[ [ <placeholder> [ swap templates get set-at ] keep , ] curry ] bi over push-all ; [ [ <placeholder> [ swap templates get set-at ] keep , ] curry ] bi append! ;
: insert-gadget ( number parent gadget -- ) -rot [ but-last insert-nth ] change-children drop ; : insert-gadget ( number parent gadget -- ) -rot [ but-last insert-nth ] change-children drop ;
: insert-size ( number parent size -- ) -rot [ but-last insert-nth ] change-sizes drop ; : insert-size ( number parent size -- ) -rot [ but-last insert-nth ] change-sizes drop ;