Conflicts:
	basis/locals/locals.factor
	basis/peg/peg.factor
	extra/infix/infix.factor
db4
Joe Groff 2009-10-28 16:17:24 -05:00
commit 3fbe722561
191 changed files with 464 additions and 839 deletions

View File

@ -501,9 +501,9 @@ M: double-2-rep rep-component-type drop double ;
: c-type-interval ( c-type -- from to )
{
{ [ dup { float double } memq? ] [ drop -1/0. 1/0. ] }
{ [ dup { char short int long longlong } memq? ] [ signed-interval ] }
{ [ dup { uchar ushort uint ulong ulonglong } memq? ] [ unsigned-interval ] }
{ [ dup { float double } member-eq? ] [ drop -1/0. 1/0. ] }
{ [ dup { char short int long longlong } member-eq? ] [ signed-interval ] }
{ [ dup { uchar ushort uint ulong ulonglong } member-eq? ] [ unsigned-interval ] }
} cond ; foldable
: c-type-clamp ( value c-type -- value' ) c-type-interval clamp ; inline

View File

@ -205,9 +205,6 @@ M: fortran-type (fortran-ret-type>c-type) (fortran-type>c-type) ;
M: real-type (fortran-ret-type>c-type)
drop real-functions-return-double? [ "double" ] [ "float" ] if ;
: suffix! ( seq elt -- seq ) over push ; inline
: append! ( seq-a seq-b -- seq-a ) over push-all ; inline
GENERIC: (fortran-arg>c-args) ( type -- main-quot added-quot )
: args?dims ( type quot -- main-quot added-quot )

View File

@ -7,11 +7,11 @@ effects assocs combinators lexer strings.parser alien.parser
fry vocabs.parser words.constant alien.libraries ;
IN: alien.syntax
SYNTAX: DLL" lexer get skip-blank parse-string dlopen parsed ;
SYNTAX: DLL" lexer get skip-blank parse-string dlopen suffix! ;
SYNTAX: ALIEN: 16 scan-base <alien> parsed ;
SYNTAX: ALIEN: 16 scan-base <alien> suffix! ;
SYNTAX: BAD-ALIEN <bad-alien> parsed ;
SYNTAX: BAD-ALIEN <bad-alien> suffix! ;
SYNTAX: LIBRARY: scan "c-library" set ;
@ -37,7 +37,7 @@ ERROR: no-such-symbol name library ;
2dup load-library dlsym [ 2nip ] [ no-such-symbol ] if* ;
SYNTAX: &:
scan "c-library" get '[ _ _ address-of ] over push-all ;
scan "c-library" get '[ _ _ address-of ] append! ;
: global-quot ( type word -- quot )
name>> "c-library" get '[ _ _ address-of 0 ]

View File

@ -25,11 +25,11 @@ HELP: sorted-member?
{ member? sorted-member? } related-words
HELP: sorted-memq?
HELP: sorted-member-eq?
{ $values { "obj" object } { "seq" "a sorted sequence" } { "?" "a boolean" } }
{ $description "Tests if the sorted sequence contains " { $snippet "elt" } ". Equality is tested with " { $link eq? } "." } ;
{ memq? sorted-memq? } related-words
{ member-eq? sorted-member-eq? } related-words
ARTICLE: "binary-search" "Binary search"
"The " { $emphasis "binary search" } " algorithm allows elements to be located in sorted sequence in " { $snippet "O(log n)" } " time."
@ -38,7 +38,7 @@ ARTICLE: "binary-search" "Binary search"
{ $subsections
sorted-index
sorted-member?
sorted-memq?
sorted-member-eq?
}
{ $see-also "order-specifiers" "sequences-sorting" } ;

View File

@ -49,5 +49,5 @@ HINTS: natural-search array ;
: sorted-member? ( obj seq -- ? )
dupd natural-search nip = ;
: sorted-memq? ( obj seq -- ? )
: sorted-member-eq? ( obj seq -- ? )
dupd natural-search nip eq? ;

View File

@ -55,7 +55,7 @@ HELP: clear-bits
{ $values { "bit-array" bit-array } }
{ $description "Sets all elements of the bit array to " { $link f } "." }
{ $notes "Calling this word is more efficient than the following:"
{ $code "[ drop f ] change-each" }
{ $code "[ drop f ] map! drop" }
}
{ $side-effects "bit-array" } ;
@ -63,7 +63,7 @@ HELP: set-bits
{ $values { "bit-array" bit-array } }
{ $description "Sets all elements of the bit array to " { $link t } "." }
{ $notes "Calling this word is more efficient than the following:"
{ $code "[ drop t ] change-each" }
{ $code "[ drop t ] map! drop" }
}
{ $side-effects "bit-array" } ;

View File

@ -20,7 +20,7 @@ IN: bit-arrays.tests
[
{ t f t } { f t f }
] [
{ t f t } >bit-array dup clone dup [ not ] change-each
{ t f t } >bit-array dup clone [ not ] map!
[ >array ] bi@
] unit-test

View File

@ -94,7 +94,7 @@ gc
"." write flush
{
memq? split harvest sift cut cut-slice start index clone
member-eq? split harvest sift cut cut-slice start index clone
set-at reverse push-all class number>string string>number
like clone-like
} compile-unoptimized
@ -118,4 +118,4 @@ gc
" done" print flush
] unless
] unless

View File

@ -351,7 +351,7 @@ M: f '
[ ] [ "Not in image: " word-error ] ?if ;
: fixup-words ( -- )
image get [ dup word? [ fixup-word ] when ] change-each ;
image get [ dup word? [ fixup-word ] when ] map! drop ;
M: word ' ;

View File

@ -7,4 +7,4 @@ SYNTAX: HEX{
"}" parse-tokens "" join
[ blank? not ] filter
2 group [ hex> ] B{ } map-as
parsed ;
suffix! ;

View File

@ -350,7 +350,7 @@ PRIVATE>
: parse-struct-slots ( slots -- slots' more? )
scan {
{ ";" [ f ] }
{ "{" [ parse-struct-slot over push t ] }
{ "{" [ parse-struct-slot suffix! t ] }
{ f [ unexpected-eof ] }
[ invalid-struct-slot ]
} case ;
@ -365,10 +365,10 @@ SYNTAX: UNION-STRUCT:
parse-struct-definition define-union-struct-class ;
SYNTAX: S{
scan-word dup struct-slots parse-tuple-literal-slots parsed ;
scan-word dup struct-slots parse-tuple-literal-slots suffix! ;
SYNTAX: S@
scan-word scan-object swap memory>struct parsed ;
scan-word scan-object swap memory>struct suffix! ;
! functor support
@ -378,7 +378,7 @@ SYNTAX: S@
: parse-struct-slot` ( accum -- accum )
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? )
scan {
@ -389,10 +389,10 @@ SYNTAX: S@
PRIVATE>
FUNCTOR-SYNTAX: STRUCT:
scan-param parsed
[ 8 <vector> ] over push-all
scan-param suffix!
[ 8 <vector> ] append!
[ parse-struct-slots` ] [ ] while
[ >array define-struct-class ] over push-all ;
[ >array define-struct-class ] append! ;
USING: vocabs vocabs.loader ;

View File

@ -14,14 +14,14 @@ SYMBOL: sent-messages
: remember-send ( selector -- )
sent-messages (remember-send) ;
SYNTAX: -> scan dup remember-send parsed \ send parsed ;
SYNTAX: -> scan dup remember-send suffix! \ send suffix! ;
SYMBOL: super-sent-messages
: remember-super-send ( selector -- )
super-sent-messages (remember-send) ;
SYNTAX: SUPER-> scan dup remember-super-send parsed \ super-send parsed ;
SYNTAX: SUPER-> scan dup remember-super-send suffix! \ super-send suffix! ;
SYMBOL: frameworks

View File

@ -30,4 +30,4 @@ ERROR: no-such-color name ;
: named-color ( name -- color )
dup colors at [ ] [ no-such-color ] ?if ;
SYNTAX: COLOR: scan named-color parsed ;
SYNTAX: COLOR: scan named-color suffix! ;

View File

@ -5,5 +5,5 @@ IN: columns.tests
{ { 1 2 3 } { 4 5 6 } { 7 8 9 } } [ clone ] map "seq" set
[ { 1 4 7 } ] [ "seq" get 0 <column> >array ] unit-test
[ ] [ "seq" get 1 <column> [ sq ] change-each ] unit-test
[ ] [ "seq" get 1 <column> [ sq ] map! drop ] unit-test
[ { 4 25 64 } ] [ "seq" get 1 <column> >array ] unit-test

View File

@ -49,7 +49,7 @@ ERROR: bad-kill-insn bb ;
ERROR: bad-successors ;
: check-successors ( bb -- )
dup successors>> [ predecessors>> memq? ] with all?
dup successors>> [ predecessors>> member-eq? ] with all?
[ bad-successors ] unless ;
: check-basic-block ( bb -- )

View File

@ -90,5 +90,5 @@ SYMBOLS:
{ cc/> { +lt+ +eq+ +unordered+ } }
{ cc/<> { +eq+ +unordered+ } }
{ cc/<>= { +unordered+ } }
} at memq? ;
} at member-eq? ;

View File

@ -63,7 +63,7 @@ M: insn update-insn rename-insn-uses t ;
copies get dup assoc-empty? [ 2drop ] [
renamings set
[
instructions>> [ update-insn ] filter-here
instructions>> [ update-insn ] filter! drop
] each-basic-block
] if ;

View File

@ -117,5 +117,5 @@ M: insn live-insn? defs-vreg [ live-vreg? ] [ t ] if* ;
dup
[ [ instructions>> [ build-liveness-graph ] each ] each-basic-block ]
[ [ instructions>> [ compute-live-vregs ] each ] each-basic-block ]
[ [ instructions>> [ live-insn? ] filter-here ] each-basic-block ]
[ [ instructions>> [ live-insn? ] filter! drop ] each-basic-block ]
tri ;

View File

@ -26,7 +26,7 @@ IN: compiler.cfg.hats
: hat-effect ( insn -- effect )
"insn-slots" word-prop
[ type>> { def temp } memq? not ] filter [ name>> ] map
[ type>> { def temp } member-eq? not ] filter [ name>> ] map
{ "vreg" } <effect> ;
: define-hat ( insn -- )

View File

@ -833,7 +833,7 @@ SYMBOL: vreg-insn
[
vreg-insn
insn-classes get [
"insn-slots" word-prop [ type>> { def use temp } memq? ] any?
"insn-slots" word-prop [ type>> { def use temp } member-eq? ] any?
] filter
define-union-class
] with-compilation-unit

View File

@ -42,7 +42,7 @@ IN: compiler.cfg.linear-scan.allocation
: handle-sync-point ( n -- )
[ active-intervals get values ] dip
'[ [ _ spill-at-sync-point ] filter-here ] each ;
'[ [ _ spill-at-sync-point ] filter! drop ] each ;
:: handle-progress ( n sync? -- )
n {

View File

@ -18,13 +18,13 @@ ERROR: bad-live-ranges interval ;
: trim-before-ranges ( live-interval -- )
[ ranges>> ] [ uses>> last 1 + ] bi
[ '[ from>> _ <= ] filter-here ]
[ '[ from>> _ <= ] filter! drop ]
[ swap last (>>to) ]
2bi ;
: trim-after-ranges ( live-interval -- )
[ ranges>> ] [ uses>> first ] bi
[ '[ to>> _ >= ] filter-here ]
[ '[ to>> _ >= ] filter! drop ]
[ swap first (>>from) ]
2bi ;
@ -103,7 +103,7 @@ ERROR: bad-live-ranges interval ;
! most one) are split and spilled and removed from the inactive
! set.
new vreg>> active-intervals-for [ [ reg>> reg = ] find swap dup ] keep
'[ _ delete-nth new start>> spill ] [ 2drop ] if ;
'[ _ remove-nth! drop new start>> spill ] [ 2drop ] if ;
:: spill-intersecting-inactive ( new reg -- )
! Any inactive intervals using 'reg' are split and spilled
@ -114,7 +114,7 @@ ERROR: bad-live-ranges interval ;
new start>> spill f
] [ drop t ] if
] [ drop t ] if
] filter-here ;
] filter! drop ;
: spill-intersecting ( new reg -- )
! Split and spill all active and inactive intervals
@ -141,4 +141,4 @@ ERROR: bad-live-ranges interval ;
{ [ 2dup spill-new? ] [ spill-new ] }
{ [ 2dup register-available? ] [ spill-available ] }
[ spill-partially-available ]
} cond ;
} cond ;

View File

@ -33,7 +33,7 @@ SYMBOL: active-intervals
dup vreg>> active-intervals-for push ;
: delete-active ( live-interval -- )
dup vreg>> active-intervals-for delq ;
dup vreg>> active-intervals-for remove-eq! drop ;
: assign-free-register ( new registers -- )
pop >>reg add-active ;
@ -48,7 +48,7 @@ SYMBOL: inactive-intervals
dup vreg>> inactive-intervals-for push ;
: delete-inactive ( live-interval -- )
dup vreg>> inactive-intervals-for delq ;
dup vreg>> inactive-intervals-for remove-eq! drop ;
! Vector of handled live intervals
SYMBOL: handled-intervals
@ -83,7 +83,7 @@ ERROR: register-already-used live-interval ;
! Moving intervals between active and inactive sets
: process-intervals ( n symbol quots -- )
! symbol stores an alist mapping register classes to vectors
[ get values ] dip '[ [ _ cond ] with filter-here ] with each ; inline
[ get values ] dip '[ [ _ cond ] with filter! drop ] with each ; inline
: deactivate-intervals ( n -- )
! Any active intervals which have ended are moved to handled

View File

@ -152,8 +152,8 @@ ERROR: bad-live-interval live-interval ;
! to reverse some sequences, and compute the start and end.
values dup [
{
[ ranges>> reverse-here ]
[ uses>> reverse-here ]
[ ranges>> reverse! drop ]
[ uses>> reverse! drop ]
[ compute-start/end ]
[ check-start ]
} cleave
@ -187,4 +187,4 @@ ERROR: bad-live-interval live-interval ;
} cond ;
: intervals-intersect? ( interval1 interval2 -- ? )
relevant-ranges intersect-live-ranges >boolean ; inline
relevant-ranges intersect-live-ranges >boolean ; inline

View File

@ -12,7 +12,7 @@ IN: compiler.cfg.predecessors
: update-phi ( bb ##phi -- )
[
swap predecessors>>
'[ drop _ memq? ] assoc-filter
'[ drop _ member-eq? ] assoc-filter
] change-inputs drop ;
: update-phis ( bb -- )
@ -30,4 +30,4 @@ PRIVATE>
: needs-predecessors ( cfg -- cfg' )
dup predecessors-valid?>>
[ compute-predecessors t >>predecessors-valid? ] unless ;
[ compute-predecessors t >>predecessors-valid? ] unless ;

View File

@ -1,6 +1,6 @@
! Copyright (C) 2008, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors namespaces kernel parser assocs ;
USING: accessors namespaces kernel parser assocs sequences ;
IN: compiler.cfg.registers
! Virtual registers, used by CFG and machine IRs, are just integers
@ -42,5 +42,5 @@ C: <ds-loc> ds-loc
TUPLE: rs-loc < loc ;
C: <rs-loc> rs-loc
SYNTAX: D scan-word <ds-loc> parsed ;
SYNTAX: R scan-word <rs-loc> parsed ;
SYNTAX: D scan-word <ds-loc> suffix! ;
SYNTAX: R scan-word <rs-loc> suffix! ;

View File

@ -26,7 +26,7 @@ GENERIC: uses-vreg-reps ( insn -- reps )
bi define ;
: reps-getter-quot ( reps -- quot )
dup [ rep>> { f scalar-rep } memq? not ] all? [
dup [ rep>> { f scalar-rep } member-eq? not ] all? [
[ rep>> ] map [ drop ] swap suffix
] [
[ rep>> rep-getter-quot ] map dup length {

View File

@ -209,7 +209,7 @@ RENAMING: convert [ converted-value ] [ converted-value ] [ ]
: perform-renaming ( insn -- )
needs-renaming? get [
renaming-set get reverse-here
renaming-set get reverse! drop
[ convert-insn-uses ] [ convert-insn-defs ] bi
renaming-set get length 0 assert=
] [ drop ] if ;

View File

@ -102,7 +102,7 @@ M: ##phi prepare-insn
[ rename-insn-defs ]
[ rename-insn-uses ]
[ [ useless-copy? ] [ ##phi? ] bi or not ] tri
] filter-here
] filter! drop
] each-basic-block ;
: destruct-ssa ( cfg -- cfg' )
@ -114,4 +114,4 @@ M: ##phi prepare-insn
dup compute-live-ranges
dup prepare-coalescing
process-copies
dup perform-renaming ;
dup perform-renaming ;

View File

@ -13,7 +13,7 @@ IN: compiler.cfg.useless-conditionals
##compare-imm-branch
##compare-float-ordered-branch
##compare-float-unordered-branch
} memq?
} member-eq?
]
[ successors>> first2 [ skip-empty-blocks ] bi@ eq? ]
} 1&& ;

View File

@ -40,8 +40,8 @@ SYMBOL: visited
:: insert-basic-block ( froms to bb -- )
bb froms V{ } like >>predecessors drop
bb to 1vector >>successors drop
to predecessors>> [ dup froms memq? [ drop bb ] when ] change-each
froms [ successors>> [ dup to eq? [ drop bb ] when ] change-each ] each ;
to predecessors>> [ dup froms member-eq? [ drop bb ] when ] map! drop
froms [ successors>> [ dup to eq? [ drop bb ] when ] map! drop ] each ;
: add-instructions ( bb quot -- )
[ instructions>> building ] dip '[

View File

@ -42,7 +42,7 @@ M: ##load-constant >expr obj>> <constant> ;
<<
: input-values ( slot-specs -- slot-specs' )
[ type>> { use literal constant } memq? ] filter ;
[ type>> { use literal constant } member-eq? ] filter ;
: expr-class ( insn -- expr )
name>> "##" ?head drop "-expr" append create-class-in ;

View File

@ -111,7 +111,7 @@ M: ##compare-imm rewrite-tagged-comparison
{
[ src1>> vreg>expr general-compare-expr? ]
[ src2>> \ f tag-number = ]
[ cc>> { cc= cc/= } memq? ]
[ cc>> { cc= cc/= } member-eq? ]
} 1&& ; inline
: rewrite-redundant-comparison ( insn -- insn' )
@ -174,7 +174,7 @@ M: ##compare-imm-branch rewrite
[ src1>> ] [ src2>> ] bi [ vreg>vn ] bi@ = ; inline
: (rewrite-self-compare) ( insn -- ? )
cc>> { cc= cc<= cc>= } memq? ;
cc>> { cc= cc<= cc>= } member-eq? ;
: rewrite-self-compare-branch ( insn -- insn' )
(rewrite-self-compare) fold-branch ;
@ -279,7 +279,7 @@ M: ##not rewrite
##sub-imm
##mul
##mul-imm
} memq? ;
} member-eq? ;
: immediate? ( value op -- ? )
arithmetic-op? [ immediate-arithmetic? ] [ immediate-bitwise? ] if ;

View File

@ -37,7 +37,7 @@ M: insn eliminate-write-barrier drop t ;
: write-barriers-step ( bb -- )
H{ } clone fresh-allocations set
H{ } clone mutated-objects set
instructions>> [ eliminate-write-barrier ] filter-here ;
instructions>> [ eliminate-write-barrier ] filter! drop ;
: eliminate-write-barriers ( cfg -- cfg' )
dup [ write-barriers-step ] each-basic-block ;

View File

@ -19,7 +19,7 @@ IN: compiler.tests.stack-trace
: bleh ( seq -- seq' ) [ 3 + ] map [ 0 > ] filter ;
: stack-trace-any? ( word -- ? ) symbolic-stack-trace memq? ;
: stack-trace-any? ( word -- ? ) symbolic-stack-trace member-eq? ;
[ t ] [
[ { 1 "hi" } bleh ] ignore-errors \ + stack-trace-any?

View File

@ -20,7 +20,7 @@ IN: compiler.tree.cleanup
GENERIC: delete-node ( node -- )
M: #call-recursive delete-node
dup label>> calls>> [ node>> eq? not ] with filter-here ;
dup label>> calls>> [ node>> eq? not ] with filter! drop ;
M: #return-recursive delete-node
label>> f >>return drop ;

View File

@ -75,7 +75,7 @@ M: #push compute-modular-candidates*
0 cell-bits tag-bits get - 1 - [a,b] interval-subset? ;
: modular-word? ( #call -- ? )
dup word>> { shift fixnum-shift bignum-shift } memq?
dup word>> { shift fixnum-shift bignum-shift } member-eq?
[ node-input-infos second interval>> small-shift? ]
[ word>> "modular-arithmetic" word-prop ]
if ;
@ -178,10 +178,10 @@ MEMO: fixnum-coercion ( flags -- nodes )
] when ;
: like->fixnum? ( #call -- ? )
word>> { >fixnum bignum>fixnum float>fixnum } memq? ;
word>> { >fixnum bignum>fixnum float>fixnum } member-eq? ;
: like->integer? ( #call -- ? )
word>> { >integer >bignum fixnum>bignum } memq? ;
word>> { >integer >bignum fixnum>bignum } member-eq? ;
M: #call optimize-modular-arithmetic*
{

View File

@ -90,7 +90,7 @@ M: callable splicing-nodes splicing-body ;
! Method body inlining
SYMBOL: history
: already-inlined? ( obj -- ? ) history get memq? ;
: already-inlined? ( obj -- ? ) history get member-eq? ;
: add-to-history ( obj -- ) history [ swap suffix ] change ;
@ -104,7 +104,7 @@ SYMBOL: history
] if ;
: always-inline-word? ( word -- ? )
{ curry compose } memq? ;
{ curry compose } member-eq? ;
: never-inline-word? ( word -- ? )
{ [ deferred? ] [ "default" word-prop ] [ \ call eq? ] } 1|| ;

View File

@ -867,8 +867,8 @@ SYMBOL: not-an-assoc
[ t ] [ [ { 1 2 3 } member? ] { member? } inlined? ] unit-test
[ f ] [ [ { 1 2 3 } swap member? ] { member? } inlined? ] unit-test
[ t ] [ [ { 1 2 3 } memq? ] { memq? } inlined? ] unit-test
[ f ] [ [ { 1 2 3 } swap memq? ] { memq? } inlined? ] unit-test
[ t ] [ [ { 1 2 3 } member-eq? ] { member-eq? } inlined? ] unit-test
[ f ] [ [ { 1 2 3 } swap member-eq? ] { member-eq? } inlined? ] unit-test
[ t ] [ [ V{ } clone ] { clone (clone) } inlined? ] unit-test
[ f ] [ [ { } clone ] { clone (clone) } inlined? ] unit-test

View File

@ -11,7 +11,7 @@ IN: compiler.tree.propagation.slots
UNION: fixed-length-sequence array byte-array string ;
: sequence-constructor? ( word -- ? )
{ <array> <byte-array> (byte-array) <string> } memq? ;
{ <array> <byte-array> (byte-array) <string> } member-eq? ;
: constructor-output-class ( word -- class )
{

View File

@ -213,12 +213,12 @@ ERROR: bad-partial-eval quot word ;
] [ drop f ] if
] 1 define-partial-eval
: memq-quot ( seq -- newquot )
: member-eq-quot ( seq -- newquot )
[ [ dupd eq? ] curry [ drop t ] ] { } map>assoc
[ drop f ] suffix [ cond ] curry ;
\ memq? [
dup sequence? [ memq-quot ] [ drop f ] if
\ member-eq? [
dup sequence? [ member-eq-quot ] [ drop f ] if
] 1 define-partial-eval
! Membership testing

View File

@ -29,7 +29,7 @@ PRIVATE>
: [future] ( quot -- quot' ) '[ _ curry future ] ; inline
: future-values ( futures -- futures )
dup [ ?future ] change-each ; inline
[ ?future ] map! ; inline
PRIVATE>

View File

@ -0,0 +1 @@
unportable

View File

@ -1,10 +1,10 @@
! Copyright (C) 2007, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: parser layouts system kernel ;
USING: parser layouts system kernel sequences ;
IN: bootstrap.ppc
: c-area-size ( -- n ) 10 bootstrap-cells ;
: lr-save ( -- n ) bootstrap-cell ;
<< "vocab:cpu/ppc/bootstrap.factor" parse-file parsed >>
<< "vocab:cpu/ppc/bootstrap.factor" parse-file suffix! >>
call

View File

@ -1,10 +1,10 @@
! Copyright (C) 2007, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: parser layouts system kernel ;
USING: parser layouts system kernel sequences ;
IN: bootstrap.ppc
: c-area-size ( -- n ) 14 bootstrap-cells ;
: lr-save ( -- n ) 2 bootstrap-cells ;
<< "vocab:cpu/ppc/bootstrap.factor" parse-file parsed >>
<< "vocab:cpu/ppc/bootstrap.factor" parse-file suffix! >>
call

View File

@ -2,7 +2,7 @@
! See http://factorcode.org/license.txt for BSD license.
USING: bootstrap.image.private kernel namespaces system
cpu.x86.assembler cpu.x86.assembler.operands layouts
vocabs parser compiler.constants ;
vocabs parser compiler.constants sequences ;
IN: bootstrap.x86
4 \ cell set
@ -35,5 +35,5 @@ IN: bootstrap.x86
0 JMP rc-relative rt-primitive jit-rel
] jit-primitive jit-define
<< "vocab:cpu/x86/bootstrap.factor" parse-file parsed >>
<< "vocab:cpu/x86/bootstrap.factor" parse-file suffix! >>
call

View File

@ -2,7 +2,7 @@
! See http://factorcode.org/license.txt for BSD license.
USING: bootstrap.image.private kernel namespaces system
layouts vocabs parser compiler.constants math
cpu.x86.assembler cpu.x86.assembler.operands ;
cpu.x86.assembler cpu.x86.assembler.operands sequences ;
IN: bootstrap.x86
8 \ cell set
@ -35,5 +35,5 @@ IN: bootstrap.x86
temp1 JMP
] jit-primitive jit-define
<< "vocab:cpu/x86/bootstrap.factor" parse-file parsed >>
<< "vocab:cpu/x86/bootstrap.factor" parse-file suffix! >>
call

View File

@ -1,12 +1,13 @@
! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: bootstrap.image.private kernel namespaces system
cpu.x86.assembler cpu.x86.assembler.operands layouts vocabs parser ;
USING: bootstrap.image.private cpu.x86.assembler
cpu.x86.assembler.operands kernel layouts namespaces parser
sequences system vocabs ;
IN: bootstrap.x86
: stack-frame-size ( -- n ) 4 bootstrap-cells ;
: arg1 ( -- reg ) RDI ;
: arg2 ( -- reg ) RSI ;
<< "vocab:cpu/x86/64/bootstrap.factor" parse-file parsed >>
<< "vocab:cpu/x86/64/bootstrap.factor" parse-file suffix! >>
call

View File

@ -1,7 +1,7 @@
! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: bootstrap.image.private kernel namespaces system
layouts vocabs parser cpu.x86.assembler
layouts vocabs sequences cpu.x86.assembler parser
cpu.x86.assembler.operands ;
IN: bootstrap.x86
@ -9,5 +9,5 @@ IN: bootstrap.x86
: arg1 ( -- reg ) RCX ;
: arg2 ( -- reg ) RDX ;
<< "vocab:cpu/x86/64/bootstrap.factor" parse-file parsed >>
<< "vocab:cpu/x86/64/bootstrap.factor" parse-file suffix! >>
call

View File

@ -65,7 +65,7 @@ M: indirect extended? base>> extended? ;
ERROR: bad-index indirect ;
: check-ESP ( indirect -- indirect )
dup index>> { ESP RSP } memq? [ bad-index ] when ;
dup index>> { ESP RSP } member-eq? [ bad-index ] when ;
: canonicalize ( indirect -- indirect )
#! Modify the indirect to work around certain addressing mode
@ -103,7 +103,7 @@ TUPLE: byte value ;
C: <byte> byte
: extended-8-bit-register? ( register -- ? )
{ SPL BPL SIL DIL } memq? ;
{ SPL BPL SIL DIL } member-eq? ;
: n-bit-version-of ( register n -- register' )
! Certain 8-bit registers don't exist in 32-bit mode...
@ -115,4 +115,4 @@ C: <byte> byte
: 16-bit-version-of ( register -- register' ) 16 n-bit-version-of ;
: 32-bit-version-of ( register -- register' ) 32 n-bit-version-of ;
: 64-bit-version-of ( register -- register' ) 64 n-bit-version-of ;
: native-version-of ( register -- register' ) cell-bits n-bit-version-of ;
: native-version-of ( register -- register' ) cell-bits n-bit-version-of ;

View File

@ -1,9 +1,9 @@
! Copyright (C) 2007, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: bootstrap.image.private kernel kernel.private namespaces system
layouts compiler.units math math.private compiler.constants vocabs
slots.private words locals.backend make sequences combinators arrays
cpu.x86.assembler cpu.x86.assembler.operands ;
USING: bootstrap.image.private compiler.constants
compiler.units cpu.x86.assembler cpu.x86.assembler.operands
kernel kernel.private layouts locals.backend make math
math.private namespaces sequences slots.private vocabs ;
IN: bootstrap.x86
big-endian off

View File

@ -254,7 +254,7 @@ CONSTANT: have-byte-regs { EAX ECX EDX EBX }
M: x86.32 has-small-reg?
{
{ 8 [ have-byte-regs memq? ] }
{ 8 [ have-byte-regs member-eq? ] }
{ 16 [ drop t ] }
{ 32 [ drop t ] }
} case ;
@ -264,7 +264,7 @@ M: x86.64 has-small-reg? 2drop t ;
: small-reg-that-isn't ( exclude -- reg' )
[ have-byte-regs ] dip
[ native-version-of ] map
'[ _ memq? not ] find nip ;
'[ _ member-eq? not ] find nip ;
: with-save/restore ( reg quot -- )
[ drop PUSH ] [ call ] [ drop POP ] 2tri ; inline
@ -356,7 +356,7 @@ M: x86 %set-alien-float [ [+] ] dip MOVSS ;
M: x86 %set-alien-double [ [+] ] dip MOVSD ;
M: x86 %set-alien-vector [ [+] ] 2dip %copy ;
: shift-count? ( reg -- ? ) { ECX RCX } memq? ;
: shift-count? ( reg -- ? ) { ECX RCX } member-eq? ;
:: emit-shift ( dst src quot -- )
src shift-count? [
@ -893,7 +893,7 @@ M: x86 %compare-vector ( dst src1 src2 rep cc -- )
M: x86 %compare-vector-reps
{
{ [ dup { cc= cc/= cc/<>= cc<>= } memq? ] [ drop %compare-vector-eq-reps ] }
{ [ dup { cc= cc/= cc/<>= cc<>= } member-eq? ] [ drop %compare-vector-eq-reps ] }
[ drop %compare-vector-ord-reps ]
} cond ;

View File

@ -34,7 +34,7 @@ TUPLE: document < model locs undos redos inside-undo? ;
: add-loc ( loc document -- ) locs>> push ;
: remove-loc ( loc document -- ) locs>> delete ;
: remove-loc ( loc document -- ) locs>> remove! drop ;
: update-locs ( loc document -- )
locs>> [ set-model ] with each ;

View File

@ -28,7 +28,7 @@ M: >r/r>-in-fry-error summary
dup { load-local load-locals get-local drop-locals } intersect
[ >r/r>-in-fry-error ] unless-empty ;
PREDICATE: fry-specifier < word { _ @ } memq? ;
PREDICATE: fry-specifier < word { _ @ } member-eq? ;
GENERIC: count-inputs ( quot -- n )
@ -53,4 +53,4 @@ M: callable deep-fry
M: object deep-fry , ;
SYNTAX: '[ parse-quotation fry over push-all ;
SYNTAX: '[ parse-quotation fry append! ;

View File

@ -42,85 +42,85 @@ M: fake-call-next-method (fake-quotations>)
M: object (fake-quotations>) , ;
: parse-definition* ( accum -- accum )
parse-definition >fake-quotations parsed
[ fake-quotations> first ] over push-all ;
parse-definition >fake-quotations suffix!
[ fake-quotations> first ] append! ;
: parse-declared* ( accum -- accum )
complete-effect
[ parse-definition* ] dip
parsed ;
suffix! ;
FUNCTOR-SYNTAX: TUPLE:
scan-param parsed
scan-param suffix!
scan {
{ ";" [ tuple parsed f parsed ] }
{ "<" [ scan-param parsed [ parse-tuple-slots ] { } make parsed ] }
{ ";" [ tuple suffix! f suffix! ] }
{ "<" [ scan-param suffix! [ parse-tuple-slots ] { } make suffix! ] }
[
[ tuple parsed ] dip
[ tuple suffix! ] dip
[ parse-slot-name [ parse-tuple-slots ] when ] { }
make parsed
make suffix!
]
} case
\ define-tuple-class parsed ;
\ define-tuple-class suffix! ;
FUNCTOR-SYNTAX: SINGLETON:
scan-param parsed
\ define-singleton-class parsed ;
scan-param suffix!
\ define-singleton-class suffix! ;
FUNCTOR-SYNTAX: MIXIN:
scan-param parsed
\ define-mixin-class parsed ;
scan-param suffix!
\ define-mixin-class suffix! ;
FUNCTOR-SYNTAX: M:
scan-param parsed
scan-param parsed
[ create-method-in dup method-body set ] over push-all
scan-param suffix!
scan-param suffix!
[ create-method-in dup method-body set ] append!
parse-definition*
\ define* parsed ;
\ define* suffix! ;
FUNCTOR-SYNTAX: C:
scan-param parsed
scan-param parsed
scan-param suffix!
scan-param suffix!
complete-effect
[ [ [ boa ] curry ] over push-all ] dip parsed
\ define-declared* parsed ;
[ [ [ boa ] curry ] append! ] dip suffix!
\ define-declared* suffix! ;
FUNCTOR-SYNTAX: :
scan-param parsed
scan-param suffix!
parse-declared*
\ define-declared* parsed ;
\ define-declared* suffix! ;
FUNCTOR-SYNTAX: SYMBOL:
scan-param parsed
\ define-symbol parsed ;
scan-param suffix!
\ define-symbol suffix! ;
FUNCTOR-SYNTAX: SYNTAX:
scan-param parsed
scan-param suffix!
parse-definition*
\ define-syntax parsed ;
\ define-syntax suffix! ;
FUNCTOR-SYNTAX: INSTANCE:
scan-param parsed
scan-param parsed
\ add-mixin-instance parsed ;
scan-param suffix!
scan-param suffix!
\ add-mixin-instance suffix! ;
FUNCTOR-SYNTAX: GENERIC:
scan-param parsed
complete-effect parsed
\ define-simple-generic* parsed ;
scan-param suffix!
complete-effect suffix!
\ define-simple-generic* suffix! ;
FUNCTOR-SYNTAX: MACRO:
scan-param parsed
scan-param suffix!
parse-declared*
\ define-macro parsed ;
\ 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 } parsed ;
FUNCTOR-SYNTAX: call-next-method T{ fake-call-next-method } suffix! ;
: (INTERPOLATE) ( accum quot -- accum )
[ scan interpolate-locals ] dip
'[ _ with-string-writer @ ] parsed ;
'[ _ with-string-writer @ ] suffix! ;
PRIVATE>

View File

@ -52,7 +52,7 @@ HELP: <groups>
{ $examples
{ $example
"USING: arrays kernel prettyprint sequences grouping ;"
"9 >array 3 <groups> dup reverse-here concat >array ." "{ 6 7 8 3 4 5 0 1 2 }"
"9 >array 3 <groups> reverse! concat >array ." "{ 6 7 8 3 4 5 0 1 2 }"
}
{ $example
"USING: kernel prettyprint sequences grouping ;"
@ -68,7 +68,7 @@ HELP: <sliced-groups>
{ $example
"USING: arrays kernel prettyprint sequences grouping ;"
"9 >array 3 <sliced-groups>"
"dup [ reverse-here ] each concat >array ."
"dup [ reverse! drop ] each concat >array ."
"{ 2 1 0 5 4 3 8 7 6 }"
}
{ $example

View File

@ -10,7 +10,7 @@ tips [ V{ } clone ] initialize
TUPLE: tip < identity-tuple content loc ;
M: tip forget* tips get delq ;
M: tip forget* tips get remove-eq! drop ;
M: tip where loc>> ;
@ -58,4 +58,4 @@ H{
: $tips-of-the-day ( element -- )
drop tips get [ nl nl ] [ content>> print-element ] interleave ;
INSTANCE: tip definition
INSTANCE: tip definition

View File

@ -101,7 +101,7 @@ SYNTAX: HINTS:
{ { fixnum fixnum string } { fixnum fixnum array } }
"specializer" set-word-prop
\ reverse-here
\ reverse!
{ { string } { array } }
"specializer" set-word-prop
@ -119,7 +119,7 @@ SYNTAX: HINTS:
\ split, { string string } "specializer" set-word-prop
\ memq? { array } "specializer" set-word-prop
\ member-eq? { array } "specializer" set-word-prop
\ member? { array } "specializer" set-word-prop

View File

@ -31,14 +31,14 @@ DEFER: <% delimiter
: found-<% ( accum lexer col -- accum )
[
over line-text>>
[ column>> ] 2dip subseq parsed
\ write parsed
[ column>> ] 2dip subseq suffix!
\ write suffix!
] 2keep 2 + >>column drop ;
: still-looking ( accum lexer -- accum )
[
[ line-text>> ] [ column>> ] bi tail
parsed \ print parsed
suffix! \ print suffix!
] keep next-line ;
: parse-%> ( accum lexer -- accum )

View File

@ -193,7 +193,7 @@ M: response clone
[ cookies>> ] dip '[ [ _ ] dip name>> = ] find nip ;
: delete-cookie ( request/response name -- )
over cookies>> [ get-cookie ] dip delete ;
over cookies>> [ get-cookie ] dip remove! drop ;
: put-cookie ( request/response cookie -- request/response )
[ name>> dupd get-cookie [ dupd delete-cookie ] when* ] keep

View File

@ -354,7 +354,7 @@ SINGLETONS: YUV420 YUV444 Y MAGIC! ;
[ decode-macroblock 2array ] accumulator
[ all-macroblocks ] dip
jpeg> setup-bitmap draw-macroblocks
jpeg> bitmap>> 3 <groups> [ color-transform ] change-each
jpeg> bitmap>> 3 <groups> [ color-transform ] map! drop
jpeg> [ >byte-array ] change-bitmap drop ;
ERROR: not-a-jpeg-image ;

View File

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

View File

@ -97,7 +97,7 @@ SYMBOL: visited
[
dup flattenable? [
def>>
[ visited get memq? [ no-recursive-inverse ] when ]
[ visited get member-eq? [ no-recursive-inverse ] when ]
[ flatten ]
bi
] [ 1quotation ] if
@ -149,7 +149,7 @@ MACRO: undo ( quot -- ) [undo] ;
\ tri* 3 [ [ [undo] ] tri@ '[ _ _ _ tri* ] ] define-pop-inverse
\ not define-involution
\ >boolean [ dup { t f } memq? assure ] define-inverse
\ >boolean [ dup { t f } member-eq? assure ] define-inverse
\ tuple>array \ >tuple define-dual
\ reverse define-involution

View File

@ -73,7 +73,7 @@ HINTS: >buffer byte-array buffer ;
bi ; inline
: search-buffer-until ( pos fill ptr separators -- n )
[ [ swap alien-unsigned-1 ] dip memq? ] 2curry find-from drop ; inline
[ [ swap alien-unsigned-1 ] dip member-eq? ] 2curry find-from drop ; inline
: finish-buffer-until ( buffer n -- byte-array separator )
[

View File

@ -67,7 +67,7 @@ TUPLE: range ufirst ulast bfirst blast ;
126 /mod HEX: 81 + swap
10 /mod HEX: 30 + swap
HEX: 81 +
4byte-array dup reverse-here ;
4byte-array reverse! ;
: >interval-map-by ( start-quot end-quot value-quot seq -- interval-map )
'[ _ [ @ 2array ] _ tri ] { } map>assoc <interval-map> ; inline

View File

@ -31,7 +31,7 @@ M: iso2022 <encoder>
M: iso2022 <decoder>
make-iso-coder <decoder> ;
<< SYNTAX: ESC HEX: 16 parsed ; >>
<< SYNTAX: ESC HEX: 16 suffix! ; >>
CONSTANT: switch-ascii B{ ESC CHAR: ( CHAR: B }
CONSTANT: switch-jis201 B{ ESC CHAR: ( CHAR: J }

View File

@ -81,7 +81,7 @@ ARTICLE: "io.mmap.examples" "Memory-mapped file examples"
""
"\"mydata.dat\" char ["
" 4 <sliced-groups>"
" [ reverse-here ] change-each"
" [ reverse! drop ] map! drop"
"] with-mapped-array"
}
"Normalize a file containing packed quadrupes of floats:"
@ -91,7 +91,7 @@ ARTICLE: "io.mmap.examples" "Memory-mapped file examples"
"SPECIALIZED-ARRAY: float-4"
""
"\"mydata.dat\" float-4 ["
" [ normalize ] change-each"
" [ normalize ] map! drop"
"] with-mapped-array"
} ;

View File

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

View File

@ -123,7 +123,7 @@ M: limited-stream stream-read-partial
<PRIVATE
: (read-until) ( stream seps buf -- stream seps buf sep/f )
3dup [ [ stream-read1 dup ] dip memq? ] dip
3dup [ [ stream-read1 dup ] dip member-eq? ] dip
swap [ drop ] [ push (read-until) ] if ;
:: limited-stream-seek ( n seek-type stream -- )

View File

@ -7,11 +7,11 @@ IN: locals
SYNTAX: :>
scan locals get [ :>-outside-lambda-error ] unless*
parse-def parsed ;
parse-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: :: (::) define-declared ;

View File

@ -112,7 +112,7 @@ M: wrapper rewrite-sugar*
rewrite-wrapper ;
M: word rewrite-sugar*
dup { load-locals get-local drop-locals } memq?
dup { load-locals get-local drop-locals } member-eq?
[ >r/r>-in-lambda-error ] [ call-next-method ] if ;
M: object rewrite-sugar* , ;

View File

@ -12,7 +12,7 @@ SYMBOL: word-histogram
SYMBOL: message-histogram
: analyze-entry ( entry -- )
dup level>> { ERROR CRITICAL } memq? [ dup errors get push ] when
dup level>> { ERROR CRITICAL } member-eq? [ dup errors get push ] when
dup word-name>> word-histogram get inc-at
dup word-name>> word-names get member? [
dup [ level>> ] [ word-name>> ] [ message>> ] tri 3array

View File

@ -192,7 +192,7 @@ MEMO: array-capacity-interval ( -- interval )
: interval-sq ( i1 -- i2 ) dup interval* ;
: special-interval? ( interval -- ? )
{ empty-interval full-interval } memq? ;
{ empty-interval full-interval } member-eq? ;
: interval-singleton? ( int -- ? )
dup special-interval? [

View File

@ -10,9 +10,9 @@ tools.test math kernel sequences ;
[ f ] [ \ + object number math-both-known? ] unit-test
[ f ] [ \ number= fixnum object math-both-known? ] unit-test
[ t ] [ \ number= integer fixnum math-both-known? ] unit-test
[ f ] [ \ >fixnum \ shift derived-ops memq? ] unit-test
[ f ] [ \ >integer \ /i derived-ops memq? ] unit-test
[ t ] [ \ fixnum-shift \ shift derived-ops memq? ] unit-test
[ f ] [ \ >fixnum \ shift derived-ops member-eq? ] unit-test
[ f ] [ \ >integer \ /i derived-ops member-eq? ] unit-test
[ t ] [ \ fixnum-shift \ shift derived-ops member-eq? ] unit-test
[ { integer fixnum } ] [ \ +-integer-fixnum integer-op-input-classes ] unit-test
[ { fixnum fixnum } ] [ \ fixnum+ integer-op-input-classes ] unit-test
@ -30,4 +30,4 @@ tools.test math kernel sequences ;
[ 3 ] [ 1 2 +-integer-integer ] unit-test
[ 3 ] [ 1 >bignum 2 +-integer-integer ] unit-test
[ 3 ] [ 1 2 >bignum +-integer-integer ] unit-test
[ 3 ] [ 1 >bignum 2 >bignum +-integer-integer ] unit-test
[ 3 ] [ 1 >bignum 2 >bignum +-integer-integer ] unit-test

View File

@ -23,6 +23,6 @@ $nl
{ $code "3 10 [a,b] [ sqrt ] map" }
"Computing the factorial of 100 with a descending range:"
{ $code "100 1 [a,b] product" }
"A range can be converted into a concrete sequence using a word such as " { $link >array } ". In most cases this is unnecessary since ranges implement the sequence protocol already. It is necessary if a mutable sequence is needed, for use with words such as " { $link set-nth } " or " { $link change-each } "." ;
"A range can be converted into a concrete sequence using a word such as " { $link >array } ". In most cases this is unnecessary since ranges implement the sequence protocol already. It is necessary if a mutable sequence is needed, for use with words such as " { $link set-nth } " or " { $link map! } "." ;
ABOUT: "math.ranges"

View File

@ -8,7 +8,7 @@ TUPLE: rect { loc initial: { 0 0 } } { dim initial: { 0 0 } } ;
: <rect> ( loc dim -- rect ) rect boa ; inline
SYNTAX: RECT: scan-object scan-object <rect> parsed ;
SYNTAX: RECT: scan-object scan-object <rect> suffix! ;
: <zero-rect> ( -- rect ) rect new ; inline
@ -64,4 +64,4 @@ M: rect contains-point?
USING: vocabs vocabs.loader ;
"prettyprint" vocab [ "math.rectangles.prettyprint" require ] when
"prettyprint" vocab [ "math.rectangles.prettyprint" require ] when

View File

@ -11,9 +11,9 @@ ERROR: bad-vconvert-input value expected-type ;
<PRIVATE
: float-type? ( c-type -- ? )
{ float double } memq? ;
{ float double } member-eq? ;
: unsigned-type? ( c-type -- ? )
{ uchar ushort uint ulonglong } memq? ;
{ uchar ushort uint ulonglong } member-eq? ;
: check-vconvert-type ( value expected-type -- value )
2dup instance? [ drop ] [ bad-vconvert-input ] if ; inline

View File

@ -15,7 +15,7 @@ ERROR: bad-base-type type ;
name>> "math.vectors.simd.instances." prepend ;
: parse-base-type ( c-type -- c-type )
dup { c:char c:uchar c:short c:ushort c:int c:uint c:longlong c:ulonglong c:float c:double } memq?
dup { c:char c:uchar c:short c:ushort c:int c:uint c:longlong c:ulonglong c:float c:double } member-eq?
[ bad-base-type ] unless ;
: forget-instances ( -- )

View File

@ -6,12 +6,12 @@ IN: models.arrow.tests
"x" get [ 2 * ] <arrow> dup "z" set
[ 1 + ] <arrow> "y" set
[ ] [ "y" get activate-model ] unit-test
[ t ] [ "z" get "x" get connections>> memq? ] unit-test
[ t ] [ "z" get "x" get connections>> member-eq? ] unit-test
[ 7 ] [ "y" get value>> ] unit-test
[ ] [ 4 "x" get set-model ] unit-test
[ 9 ] [ "y" get value>> ] unit-test
[ ] [ "y" get deactivate-model ] unit-test
[ f ] [ "z" get "x" get connections>> memq? ] unit-test
[ f ] [ "z" get "x" get connections>> member-eq? ] unit-test
3 <model> "x" set
"x" get [ sq ] <arrow> "y" set

View File

@ -23,7 +23,7 @@ M: model hashcode* drop model hashcode* ;
dependencies>> push ;
: remove-dependency ( dep model -- )
dependencies>> delete ;
dependencies>> remove! drop ;
DEFER: add-connection
@ -63,7 +63,7 @@ GENERIC: model-changed ( model observer -- )
connections>> push ;
: remove-connection ( observer model -- )
[ connections>> delete ] keep
[ connections>> remove! drop ] keep
dup connections>> empty? [ dup deactivate-model ] when
drop ;

View File

@ -81,10 +81,10 @@ SYNTAX: HEREDOC:
lexer get skip-blank
rest-of-line
lexer get next-line
parse-til-line-begins parsed ;
parse-til-line-begins suffix! ;
SYNTAX: DELIMITED:
lexer get skip-blank
rest-of-line
lexer get next-line
0 (parse-multiline-string) parsed ;
0 (parse-multiline-string) suffix! ;

View File

@ -19,5 +19,5 @@ SYMBOL: G-world
<< \ gl-break t "break?" set-word-prop >>
SYNTAX: GB
\ gl-break parsed ;
\ gl-break suffix! ;

View File

@ -547,12 +547,12 @@ PRIVATE>
SYNTAX: <EBNF
"EBNF>"
reset-tokenizer parse-multiline-string parse-ebnf main swap at
parsed reset-tokenizer ;
suffix! reset-tokenizer ;
SYNTAX: [EBNF
"EBNF]"
reset-tokenizer parse-multiline-string ebnf>quot nip
parsed \ call parsed reset-tokenizer ;
suffix! \ call suffix! reset-tokenizer ;
SYNTAX: EBNF:
reset-tokenizer CREATE-WORD dup ";EBNF" parse-multiline-string

View File

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

View File

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

View File

@ -1,8 +1,8 @@
! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: layouts kernel parser math ;
USING: layouts kernel parser math sequences ;
IN: persistent.hashtables.config
: radix-bits ( -- n ) << cell 4 = 4 5 ? parsed >> ; foldable
: radix-bits ( -- n ) << cell 4 = 4 5 ? suffix! >> ; foldable
: radix-mask ( -- n ) radix-bits 2^ 1 - ; foldable
: full-bitmap-mask ( -- n ) radix-bits 2^ 2^ 1 - ; inline

View File

@ -119,7 +119,7 @@ M: pathname pprint*
"~" over class name>> "~" 3append
swap present-text
] [
over recursion-check get memq? [
over recursion-check get member-eq? [
drop "~circularity~" swap present-text
] [
over recursion-check get push

View File

@ -121,7 +121,7 @@ ARTICLE: "prettyprint-literal" "Literal prettyprinting protocol"
" scan-word \\ * assert="
" scan-word"
" scan-word \\ ] assert="
" <rect> parsed ;"
" <rect> suffix! ;"
}
"An example literal might be:"
{ $code "RECT[ 100 * 200 ]" }

View File

@ -196,7 +196,7 @@ DEFER: parse-error-file
" {"
" { [ dup continuation? ] [ append ] }"
" { [ dup not ] [ drop reverse ] }"
" { [ dup pair? ] [ [ delete ] keep ] }"
" { [ dup pair? ] [ [ remove! drop ] keep ] }"
" } cond ;"
} ;

View File

@ -96,7 +96,7 @@ HELP: delete-random
{ $values
{ "seq" sequence }
{ "elt" object } }
{ $description "Deletes a random number from a sequence using " { $link delete-nth } " and returns the deleted object." } ;
{ $description "Deletes a random number from a sequence using " { $link remove-nth! } " and returns the deleted object." } ;
ARTICLE: "random-protocol" "Random protocol"
"A random number generator must implement one of these two words:"

View File

@ -19,7 +19,7 @@ M: object random-bytes* ( n tuple -- byte-array )
[ pick '[ _ random-32* 4 >le _ push-all ] times ]
[
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* ;
M: object random-32* ( tuple -- r ) 4 swap random-bytes* le> ;
@ -82,7 +82,7 @@ PRIVATE>
'[ _ dup random _ _ next-sample ] replicate ;
: delete-random ( seq -- elt )
[ length random-integer ] keep [ nth ] 2keep delete-nth ;
[ length random-integer ] keep [ nth ] 2keep remove-nth! drop ;
: with-random ( tuple quot -- )
random-generator swap with-variable ; inline

View File

@ -200,7 +200,7 @@ PRIVATE>
: parsing-regexp ( accum end -- accum )
lexer get [ take-until ] [ parse-noblank-token ] bi
<optioned-regexp> compile-next-match parsed ;
<optioned-regexp> compile-next-match suffix! ;
PRIVATE>

View File

@ -69,4 +69,4 @@ ROMAN-OP: *
ROMAN-OP: /i
ROMAN-OP: /mod
SYNTAX: ROMAN: scan roman> parsed ;
SYNTAX: ROMAN: scan roman> suffix! ;

View File

@ -30,10 +30,10 @@ HELP: flatten
{ $values { "obj" object } { "seq" "a sequence" } }
{ $description "Creates a sequence of all of the leaf nodes (non-sequence nodes, but including strings and numbers) in the object." } ;
HELP: deep-change-each
{ $values { "obj" object } { "quot" { $quotation "( elt -- newelt )" } } }
{ $description "Modifies each sub-node of an object in place, in preorder." }
{ $see-also change-each } ;
HELP: deep-map!
{ $values { "obj" object } { "quot" { $quotation "( elt -- newelt )" } } { "obj" object } }
{ $description "Modifies each sub-node of an object in place, in preorder, and returns that object." }
{ $see-also map! } ;
ARTICLE: "sequences.deep" "Deep sequence combinators"
"The combinators in the " { $vocab-link "sequences.deep" } " vocabulary are variants of standard sequence combinators which traverse nested subsequences."
@ -43,7 +43,7 @@ ARTICLE: "sequences.deep" "Deep sequence combinators"
deep-filter
deep-find
deep-any?
deep-change-each
deep-map!
}
"A utility word to collapse nested subsequences:"
{ $subsections flatten } ;

View File

@ -17,7 +17,7 @@ IN: sequences.deep.tests
[ "hey" 1array 1array [ change-something ] deep-map ] unit-test
[ { { "heyhello" "hihello" } } ]
[ "hey" 1array 1array [ [ change-something ] deep-change-each ] keep ] unit-test
[ "hey" 1array 1array [ change-something ] deep-map! ] unit-test
[ t ] [ "foo" [ string? ] deep-any? ] unit-test

View File

@ -48,10 +48,10 @@ M: object branch? drop f ;
_ swap dup branch? [ subseq? ] [ 2drop f ] if
] deep-find >boolean ;
: deep-change-each ( obj quot: ( elt -- elt' ) -- )
: deep-map! ( obj quot: ( elt -- elt' ) -- obj )
over branch? [
'[ _ [ call ] keep over [ deep-change-each ] dip ] change-each
] [ 2drop ] if ; inline recursive
'[ _ [ call ] keep over [ deep-map! drop ] dip ] map!
] [ drop ] if ; inline recursive
: flatten ( obj -- seq )
[ branch? not ] deep-filter ;

View File

@ -50,7 +50,7 @@ CONSTANT: objects
B{ 50 13 55 64 1 }
?{ t f t f f t f }
double-array{ 1.0 3.0 4.0 1.0 2.35 0.33 }
<< 1 [ 2 ] curry parsed >>
<< 1 [ 2 ] curry suffix! >>
{ { "a" "bc" } { "de" "fg" } }
H{ { "a" "bc" } { "de" "fg" } }
}

View File

@ -222,7 +222,7 @@ SYMBOL: deserialized
:: (deserialize-seq) ( exemplar quot -- seq )
deserialize-cell exemplar new-sequence
[ intern-object ]
[ dup [ drop quot call ] change-each ] bi ; inline
[ [ drop quot call ] map! ] bi ; inline
: deserialize-array ( -- array )
{ } [ (deserialize) ] (deserialize-seq) ;

View File

@ -20,7 +20,7 @@ MACRO: shuffle-effect ( effect -- )
] [ ] make ;
SYNTAX: shuffle(
")" parse-effect parsed \ shuffle-effect parsed ;
")" parse-effect suffix! \ shuffle-effect suffix! ;
: 2swap ( x y z t -- z t x y ) 2 2 mnswap ; inline

View File

@ -45,7 +45,7 @@ SPECIALIZED-ARRAYS: bool ushort char uint float ulonglong ;
[ ushort-array{ 0 0 0 } ] [
3 ALIEN: 123 100 <direct-ushort-array> new-sequence
dup [ drop 0 ] change-each
[ drop 0 ] map!
] unit-test
STRUCT: test-struct

Some files were not shown because too many files have changed in this diff Show More