rename peek -> last and update all usages

db4
Doug Coleman 2009-05-25 16:38:33 -05:00
parent 0ac80c6917
commit 407377fc98
69 changed files with 105 additions and 106 deletions

View File

@ -69,7 +69,7 @@ nl
"." write flush
{
new-sequence nth push pop peek flip
new-sequence nth push pop last flip
} compile-unoptimized
"." write flush

View File

@ -46,13 +46,13 @@ M: growing-circular length length>> ;
: full? ( circular -- ? )
[ length ] [ seq>> length ] bi = ;
: set-peek ( elt seq -- )
: set-last ( elt seq -- )
[ length 1- ] keep set-nth ;
PRIVATE>
: push-growing-circular ( elt circular -- )
dup full? [ push-circular ]
[ [ 1+ ] change-length set-peek ] if ;
[ [ 1+ ] change-length set-last ] if ;
: <growing-circular> ( capacity -- growing-circular )
{ } new-sequence 0 0 growing-circular boa ;

View File

@ -165,7 +165,7 @@ SYMBOL: heap-ac
: record-constant-set-slot ( slot# vreg -- )
history [
dup empty? [ dup peek store? [ dup pop* ] when ] unless
dup empty? [ dup last store? [ dup pop* ] when ] unless
store new-action swap ?push
] change-at ;

View File

@ -19,7 +19,7 @@ IN: compiler.cfg.intrinsics.allot
[ second ds-load ] [ ^^load-literal ] bi prefix ;
: emit-<tuple-boa> ( node -- )
dup node-input-infos peek literal>>
dup node-input-infos last literal>>
dup array? [
nip
ds-drop

View File

@ -7,7 +7,7 @@ SYMBOL: node-stack
: >node ( cursor -- ) node-stack get push ;
: node> ( -- cursor ) node-stack get pop ;
: node@ ( -- cursor ) node-stack get peek ;
: node@ ( -- cursor ) node-stack get last ;
: current-node ( -- node ) node@ first ;
: iterate-next ( -- cursor ) node@ rest-slice ;
: skip-next ( -- next ) node> rest-slice [ first ] [ >node ] bi ;

View File

@ -23,7 +23,7 @@ IN: compiler.cfg.linear-scan.debugger
[ split-children ] map concat check-assigned ;
: picture ( uses -- str )
dup peek 1 + CHAR: space <string>
dup last 1 + CHAR: space <string>
[ '[ CHAR: * swap _ set-nth ] each ] keep ;
: interval-picture ( interval -- str )

View File

@ -244,7 +244,7 @@ SYMBOL: max-uses
swap int-regs swap vreg boa >>vreg
max-uses get random 2 max [ not-taken ] replicate natural-sort
[ >>uses ] [ first >>start ] bi
dup uses>> peek >>end
dup uses>> last >>end
] map
] with-scope ;

View File

@ -37,7 +37,7 @@ IN: compiler.cfg.useless-blocks
: delete-conditional? ( bb -- ? )
dup instructions>> [ drop f ] [
peek class {
last class {
##compare-branch
##compare-imm-branch
##compare-float-branch

View File

@ -28,7 +28,7 @@ M: #branch remove-dead-code*
: remove-phi-inputs ( #phi -- )
if-node get children>>
[ dup ends-with-terminate? [ drop f ] [ peek out-d>> ] if ] map
[ dup ends-with-terminate? [ drop f ] [ last out-d>> ] if ] map
pad-with-bottom >>phi-in-d drop ;
: live-value-indices ( values -- indices )

View File

@ -191,7 +191,7 @@ SYMBOL: node-count
propagate
compute-def-use
dup check-nodes
peek node-input-infos ;
last node-input-infos ;
: final-classes ( quot -- seq )
final-info [ class>> ] map ;

View File

@ -83,7 +83,7 @@ TUPLE: implication p q ;
C: --> implication
: assume-implication ( p q -- )
[ constraints get [ assoc-stack swap suffix ] 2keep peek set-at ]
[ constraints get [ assoc-stack swap suffix ] 2keep last set-at ]
[ satisfied? [ assume ] [ drop ] if ] 2bi ;
M: implication assume*

View File

@ -259,12 +259,12 @@ SYMBOL: value-infos
resolve-copy value-infos get assoc-stack null-info or ;
: set-value-info ( info value -- )
resolve-copy value-infos get peek set-at ;
resolve-copy value-infos get last set-at ;
: refine-value-info ( info value -- )
resolve-copy value-infos get
[ assoc-stack value-info-intersect ] 2keep
peek set-at ;
last set-at ;
: value-literal ( value -- obj ? )
value-info >literal< ;
@ -294,10 +294,10 @@ SYMBOL: value-infos
dup in-d>> first node-value-info literal>> ;
: last-literal ( #call -- obj )
dup out-d>> peek node-value-info literal>> ;
dup out-d>> last node-value-info literal>> ;
: immutable-tuple-boa? ( #call -- ? )
dup word>> \ <tuple-boa> eq? [
dup in-d>> peek node-value-info
dup in-d>> last node-value-info
literal>> first immutable-tuple-class?
] [ drop f ] if ;

View File

@ -169,7 +169,7 @@ M: #return-recursive inputs/outputs [ in-d>> ] [ out-d>> ] bi ;
[ label>> calls>> [ in-d>> ] map ] [ in-d>> ] bi suffix ;
: ends-with-terminate? ( nodes -- ? )
[ f ] [ peek #terminate? ] if-empty ;
[ f ] [ last #terminate? ] if-empty ;
M: vector child-visitor V{ } clone ;
M: vector #introduce, #introduce node, ;

View File

@ -63,7 +63,7 @@ PRIVATE>
: csv ( stream -- rows )
[ [ (csv) ] { } make ] with-input-stream
dup peek { "" } = [ but-last ] when ;
dup last { "" } = [ but-last ] when ;
: file>csv ( path encoding -- csv )
<file-reader> csv ;

View File

@ -120,7 +120,7 @@ namespaces tools.test make arrays kernel fry ;
[ "Goodbye, cruel world." ] [ "d" get doc-string ] unit-test
[ "" { 0 9 } { 0 15 } ] [
"d" get undos>> peek
"d" get undos>> last
[ old-string>> ] [ from>> ] [ new-to>> ] tri
] unit-test
@ -150,4 +150,4 @@ namespaces tools.test make arrays kernel fry ;
[ ] [ "Hello world" "d" get set-doc-string ] unit-test
[ { "" } ] [ "value" get ] unit-test
[ { "" } ] [ "value" get ] unit-test

View File

@ -86,7 +86,7 @@ CONSTANT: doc-start { 0 0 }
] [
first swap length 1- + 0
] if
] dip peek length + 2array ;
] dip last length + 2array ;
: prepend-first ( str seq -- )
0 swap [ append ] change-nth ;
@ -191,4 +191,4 @@ PRIVATE>
[ undos>> ] [ redos>> ] [ undo-edit ] undo/redo ;
: redo ( document -- )
[ redos>> ] [ undos>> ] [ redo-edit ] undo/redo ;
[ redos>> ] [ undos>> ] [ redo-edit ] undo/redo ;

View File

@ -149,15 +149,15 @@ DEFER: (parse-paragraph)
: trim-row ( seq -- seq' )
rest
dup peek empty? [ but-last ] when ;
dup last empty? [ but-last ] when ;
: ?peek ( seq -- elt/f )
[ f ] [ peek ] if-empty ;
: ?last ( seq -- elt/f )
[ f ] [ last ] if-empty ;
: coalesce ( rows -- rows' )
V{ } clone [
'[
_ dup ?peek ?peek CHAR: \\ =
_ dup ?last ?last CHAR: \\ =
[ [ pop "|" rot 3append ] keep ] when
push
] each

View File

@ -76,7 +76,7 @@ MACRO: ncleave ( quots n -- )
MACRO: nspread ( quots n -- )
over empty? [ 2drop [ ] ] [
[ [ but-last ] dip ]
[ [ peek ] dip ] 2bi
[ [ last ] dip ] 2bi
swap
'[ [ _ _ nspread ] _ ndip @ ]
] if ;

View File

@ -76,7 +76,7 @@ M: heap heap-size ( heap -- n )
data>> pop* ; inline
: data-peek ( heap -- entry )
data>> peek ; inline
data>> last ; inline
: data-first ( heap -- entry )
data>> first ; inline

View File

@ -25,7 +25,7 @@ SYMBOL: vocab-articles
[ (eval>string) ] call( code -- output )
"\n" ?tail drop
] keep
peek assert=
last assert=
] vocabs-quot get call( quot -- ) ;
: check-examples ( element -- )

View File

@ -77,7 +77,7 @@ SYNTAX: HINTS:
{ first first2 first3 first4 }
[ { array } "specializer" set-word-prop ] each
{ peek pop* pop } [
{ last pop* pop } [
{ vector } "specializer" set-word-prop
] each

View File

@ -142,7 +142,7 @@ PEG: parse-header-line ( string -- pair )
'space' ,
'attr' ,
'space' ,
[ "=" token , 'space' , 'value' , ] seq* [ peek ] action optional ,
[ "=" token , 'space' , 'value' , ] seq* [ last ] action optional ,
'space' ,
] seq* ;

View File

@ -91,7 +91,7 @@ PRIVATE>
: &back ( -- )
inspector-stack get
dup length 1 <= [ drop ] [ [ pop* ] [ peek reinspect ] bi ] if ;
dup length 1 <= [ drop ] [ [ pop* ] [ last reinspect ] bi ] if ;
: &add ( value key -- ) mirror get set-at &push reinspect ;

View File

@ -220,7 +220,7 @@ DEFER: __
\ first4 [ 4array ] define-inverse
\ prefix \ unclip define-dual
\ suffix [ dup but-last swap peek ] define-inverse
\ suffix [ dup but-last swap last ] define-inverse
\ append 1 [ [ ?tail assure ] curry ] define-pop-inverse
\ prepend 1 [ [ ?head assure ] curry ] define-pop-inverse

View File

@ -34,7 +34,7 @@ PRIVATE>
: levenshtein ( old new -- n )
[ levenshtein-initialize ] [ levenshtein-step ]
run-lcs peek peek ;
run-lcs last last ;
TUPLE: retain item ;
TUPLE: delete item ;

View File

@ -66,7 +66,7 @@ PEG: parse-log-line ( string -- entry ) 'log-line' ;
building get empty? [
"Warning: log begins with multiline entry" print drop
] [
message>> first building get peek message>> push
message>> first building get last message>> push
] if ;
: parse-log ( lines -- entries )

View File

@ -23,9 +23,9 @@ IN: math.bits.tests
] unit-test
[ t ] [
1067811677921310779 make-bits peek
1067811677921310779 make-bits last
] unit-test
[ t ] [
1067811677921310779 >bignum make-bits peek
] unit-test
1067811677921310779 >bignum make-bits last
] unit-test

View File

@ -48,7 +48,7 @@ PRIVATE>
: /-last ( seq seq -- a )
#! divide the last two numbers in the sequences
[ peek ] bi@ / ;
[ last ] bi@ / ;
: (p/mod) ( p p -- p p )
2dup /-last

View File

@ -56,14 +56,14 @@ PRIVATE>
: range-decreasing? ( range -- ? )
step>> 0 < ;
: first-or-peek ( seq head? -- elt )
[ first ] [ peek ] if ;
: first-or-last ( seq head? -- elt )
[ first ] [ last ] if ;
: range-min ( range -- min )
dup range-increasing? first-or-peek ;
dup range-increasing? first-or-last ;
: range-max ( range -- max )
dup range-decreasing? first-or-peek ;
dup range-decreasing? first-or-last ;
: clamp-to-range ( n range -- n )
[ range-min ] [ range-max ] bi clamp ;

View File

@ -370,7 +370,7 @@ SYMBOL: ignore-ws
] bind ;
M: ebnf (transform) ( ast -- parser )
rules>> [ (transform) ] map peek ;
rules>> [ (transform) ] map last ;
M: ebnf-tokenizer (transform) ( ast -- parser )
elements>> dup "default" = [

View File

@ -70,7 +70,7 @@ M: persistent-vector nth-unsafe
dup level>> 1 = [
new-child
] [
tuck children>> peek (ppush-new-tail)
tuck children>> last (ppush-new-tail)
[ swap new-child ] [ swap node-set-last f ] ?if
] if ;
@ -127,13 +127,13 @@ M: persistent-vector new-nth ( obj i pvec -- pvec' )
: ppop-contraction ( node -- node' tail' )
dup children>> length 1 =
[ children>> peek f swap ]
[ children>> last f swap ]
[ (ppop-contraction) ]
if ;
: (ppop-new-tail) ( root -- root' tail' )
dup level>> 1 > [
dup children>> peek (ppop-new-tail) [
dup children>> last (ppop-new-tail) [
dup
[ swap node-set-last ]
[ drop ppop-contraction drop ]

View File

@ -52,7 +52,7 @@ USING: kernel math parser sequences combinators splitting ;
: consonant-end? ( n seq -- ? )
[ length swap - ] keep consonant? ;
: last-is? ( str possibilities -- ? ) [ peek ] dip member? ;
: last-is? ( str possibilities -- ? ) [ last ] dip member? ;
: cvc? ( str -- ? )
{
@ -67,7 +67,7 @@ USING: kernel math parser sequences combinators splitting ;
pick consonant-seq 0 > [ nip ] [ drop ] if append ;
: step1a ( str -- newstr )
dup peek CHAR: s = [
dup last CHAR: s = [
{
{ [ "sses" ?tail ] [ "ss" append ] }
{ [ "ies" ?tail ] [ "i" append ] }
@ -199,13 +199,13 @@ USING: kernel math parser sequences combinators splitting ;
[ 1 = [ but-last-slice cvc? not ] [ drop f ] if ] if ;
: remove-e ( str -- newstr )
dup peek CHAR: e = [
dup last CHAR: e = [
dup remove-e? [ but-last-slice ] when
] when ;
: ll->l ( str -- newstr )
{
{ [ dup peek CHAR: l = not ] [ ] }
{ [ dup last CHAR: l = not ] [ ] }
{ [ dup length 1- over double-consonant? not ] [ ] }
{ [ dup consonant-seq 1 > ] [ but-last-slice ] }
[ ]

View File

@ -153,7 +153,7 @@ TUPLE: block < section sections ;
: <block> ( style -- block )
block new-block ;
: pprinter-block ( -- block ) pprinter-stack get peek ;
: pprinter-block ( -- block ) pprinter-stack get last ;
: add-section ( section -- )
pprinter-block sections>> push ;
@ -292,7 +292,7 @@ M: colon unindent-first-line? drop t ;
! Long section layout algorithm
: chop-break ( seq -- seq )
dup peek line-break? [ but-last-slice chop-break ] when ;
dup last line-break? [ but-last-slice chop-break ] when ;
SYMBOL: prev
SYMBOL: next
@ -317,7 +317,7 @@ SYMBOL: next
] { } make { t } split harvest ;
: break-group? ( seq -- ? )
[ first section-fits? ] [ peek section-fits? not ] bi and ;
[ first section-fits? ] [ last section-fits? not ] bi and ;
: ?break-group ( seq -- )
dup break-group? [ first <fresh-line ] [ drop ] if ;
@ -355,4 +355,4 @@ M: block long-section ( block -- )
] with-scope ; inline
: with-pprint ( obj quot -- )
make-pprint drop do-pprint ; inline
make-pprint drop do-pprint ; inline

View File

@ -27,4 +27,4 @@ and we didn't know hów tö do thât"> latin2 encode >quoted ] unit-test
[ 1 ] [ message >quoted string-lines length ] unit-test
[ t ] [ message >quoted-lines "=\r\n" swap subseq? ] unit-test
[ 4 ] [ message >quoted-lines string-lines length ] unit-test
[ "===o" ] [ message >quoted-lines string-lines [ peek ] "" map-as ] unit-test
[ "===o" ] [ message >quoted-lines string-lines [ last ] "" map-as ] unit-test

View File

@ -9,8 +9,8 @@ IN: quoting
{
[ length 1 > ]
[ first quote? ]
[ [ first ] [ peek ] bi = ]
[ [ first ] [ last ] bi = ]
} 1&& ;
: unquote ( str -- newstr )
dup quoted? [ but-last-slice rest-slice >string ] when ;
dup quoted? [ but-last-slice rest-slice >string ] when ;

View File

@ -6,9 +6,9 @@ IN: splitting.monotonic
<PRIVATE
: ,, ( obj -- ) building get peek push ;
: ,, ( obj -- ) building get last push ;
: v, ( -- ) V{ } clone , ;
: ,v ( -- ) building get dup peek empty? [ dup pop* ] when drop ;
: ,v ( -- ) building get dup last empty? [ dup pop* ] when drop ;
: (monotonic-split) ( seq quot -- newseq )
[

View File

@ -57,8 +57,8 @@ IN: stack-checker.transforms
[
[ no-case ]
] [
dup peek callable? [
dup peek swap but-last
dup last callable? [
dup last swap but-last
] [
[ no-case ] swap
] if case>quot

View File

@ -24,7 +24,7 @@ IN: tools.completion
2dup number=
[ drop ] [ nip V{ } clone pick push ] if
1+
] keep pick peek push
] keep pick last push
] each ;
: runs ( seq -- newseq )
@ -78,4 +78,4 @@ IN: tools.completion
all-vocabs-seq name-completions ;
: chars-matching ( str -- seq )
name-map keys dup zip completions ;
name-map keys dup zip completions ;

View File

@ -83,7 +83,7 @@ M: pasteboard set-clipboard-contents
dup { 0 0 } = [
drop
windows get length 1 <= [ -> center ] [
windows get peek second window-loc>>
windows get last second window-loc>>
dupd first2 <CGPoint> -> cascadeTopLeftFromPoint:
-> setFrameTopLeftPoint:
] if

View File

@ -59,7 +59,7 @@ SYMBOL: locale ! Just casing locale, or overall?
: fix-sigma-end ( string -- string )
[ "" ] [
dup peek CHAR: greek-small-letter-sigma =
dup last CHAR: greek-small-letter-sigma =
[ 1 head* CHAR: greek-small-letter-final-sigma suffix ] when
] if-empty ; inline

View File

@ -63,13 +63,13 @@ ducet insert-helpers
[ drop { } ]
[ [ AAAA ] [ BBBB ] bi 2array ] if ;
: last ( -- char )
building get empty? [ 0 ] [ building get peek peek ] if ;
: building-last ( -- char )
building get empty? [ 0 ] [ building get last last ] if ;
: blocked? ( char -- ? )
combining-class dup { 0 f } member?
[ drop last non-starter? ]
[ last combining-class = ] if ;
[ drop building-last non-starter? ]
[ building-last combining-class = ] if ;
: possible-bases ( -- slice-of-building )
building get dup [ first non-starter? not ] find-last

View File

@ -16,7 +16,7 @@ IN: vlists.tests
[ "foo" VL{ "hi" "there" } t ]
[
VL{ "hi" "there" "foo" } dup "v" set
[ peek ] [ ppop ] bi
[ last ] [ ppop ] bi
dup "v" get [ vector>> ] bi@ eq?
] unit-test

View File

@ -11,7 +11,7 @@ IN: xml
<PRIVATE
: add-child ( object -- )
xml-stack get peek second push ;
xml-stack get last second push ;
: push-xml ( object -- )
V{ } clone 2array xml-stack get push ;

View File

@ -215,7 +215,7 @@ M: anonymous-complement (classes-intersect?)
: min-class ( class seq -- class/f )
over [ classes-intersect? ] curry filter
[ drop f ] [
[ nip ] [ [ class<= ] with all? ] 2bi [ peek ] [ drop f ] if
[ nip ] [ [ class<= ] with all? ] 2bi [ last ] [ drop f ] if
] if-empty ;
GENERIC: (flatten-class) ( class -- )

View File

@ -152,7 +152,7 @@ ERROR: attempt-all-error ;
] [
[
[ [ , f ] compose [ , drop t ] recover ] curry all?
] { } make peek swap [ rethrow ] when
] { } make last swap [ rethrow ] when
] if ; inline
TUPLE: condition error restarts continuation ;

View File

@ -21,7 +21,7 @@ M: object dispose
: dispose-each ( seq -- )
[
[ [ dispose ] curry [ , ] recover ] each
] { } make [ peek rethrow ] unless-empty ;
] { } make [ last rethrow ] unless-empty ;
: with-disposal ( object quot -- )
over [ dispose ] curry [ ] cleanup ; inline

View File

@ -15,7 +15,7 @@ PREDICATE: math-class < class
<PRIVATE
: last/first ( seq -- pair ) [ peek ] [ first ] bi 2array ;
: last/first ( seq -- pair ) [ last ] [ first ] bi 2array ;
: bootstrap-words ( classes -- classes' )
[ bootstrap-word ] map ;

View File

@ -235,7 +235,7 @@ M: predicate-engine-word stack-effect "owner-generic" word-prop stack-effect ;
quote-methods
prune-redundant-predicates
class-predicates
[ peek ] [ alist>quot picker prepend define-predicate-engine ] if-empty ;
[ last ] [ alist>quot picker prepend define-predicate-engine ] if-empty ;
M: predicate-engine compile-engine
[ compile-predicate-engine ] [ class>> ] bi

View File

@ -12,7 +12,7 @@ IN: namespaces
PRIVATE>
: namespace ( -- namespace ) namestack* peek ; inline
: namespace ( -- namespace ) namestack* last ; inline
: namestack ( -- namestack ) namestack* clone ;
: set-namestack ( namestack -- ) >vector 0 setenv ;
: global ( -- g ) 21 getenv { hashtable } declare ; inline

View File

@ -546,12 +546,12 @@ HELP: join
{ join concat concat-as } related-words
HELP: peek
HELP: last
{ $values { "seq" sequence } { "elt" object } }
{ $description "Outputs the last element of a sequence." }
{ $errors "Throws an error if the sequence is empty." } ;
{ peek pop pop* } related-words
{ last pop pop* } related-words
HELP: pop*
{ $values { "seq" "a resizable mutable sequence" } }
@ -1382,7 +1382,7 @@ ARTICLE: "sequences-access" "Accessing sequence elements"
{ $subsection first2 }
{ $subsection first3 }
{ $subsection first4 }
{ $see-also nth peek } ;
{ $see-also nth last } ;
ARTICLE: "sequences-add-remove" "Adding and removing sequence elements"
"Adding elements:"
@ -1579,7 +1579,6 @@ ARTICLE: "sequences-destructive" "Destructive operations"
ARTICLE: "sequences-stacks" "Treating sequences as stacks"
"The classical stack operations, modifying a sequence in place:"
{ $subsection peek }
{ $subsection push }
{ $subsection pop }
{ $subsection pop* }

View File

@ -626,7 +626,7 @@ PRIVATE>
[ 0 swap copy ] keep
] new-like ;
: peek ( seq -- elt ) [ length 1 - ] [ nth ] bi ;
: last ( seq -- elt ) [ length 1 - ] [ nth ] bi ;
: pop* ( seq -- ) [ length 1 - ] [ shorten ] bi ;
@ -821,7 +821,7 @@ PRIVATE>
[ rest ] [ first-unsafe ] bi ;
: unclip-last ( seq -- butlast last )
[ but-last ] [ peek ] bi ;
[ but-last ] [ last ] bi ;
: unclip-slice ( seq -- rest-slice first )
[ rest-slice ] [ first-unsafe ] bi ; inline
@ -852,7 +852,7 @@ PRIVATE>
[ find-last ] (map-find) ; inline
: unclip-last-slice ( seq -- butlast-slice last )
[ but-last-slice ] [ peek ] bi ; inline
[ but-last-slice ] [ last ] bi ; inline
: <flat-slice> ( seq -- slice )
dup slice? [ { } like ] when

View File

@ -75,7 +75,7 @@ M: string string-lines
but-last-slice [
"\r" ?tail drop "\r" split
] map
] keep peek "\r" split suffix concat
] keep last "\r" split suffix concat
] [
1array
] if ;

View File

@ -62,7 +62,7 @@ IN: vectors.tests
[ ] [ V{ 1 5 } "funny-stack" get push ] unit-test
[ ] [ V{ 2 3 } "funny-stack" get push ] unit-test
[ V{ 2 3 } ] [ "funny-stack" get pop ] unit-test
[ V{ 1 5 } ] [ "funny-stack" get peek ] unit-test
[ V{ 1 5 } ] [ "funny-stack" get last ] unit-test
[ V{ 1 5 } ] [ "funny-stack" get pop ] unit-test
[ "funny-stack" get pop ] must-fail
[ "funny-stack" get pop ] must-fail
@ -98,4 +98,4 @@ IN: vectors.tests
[ fixnum ] [ 1 >bignum [ ] V{ } map-as length class ] unit-test
[ V{ "lulz" } ] [ "lulz" 1vector ] unit-test
[ V{ "lulz" } ] [ "lulz" 1vector ] unit-test

View File

@ -39,7 +39,7 @@ PRIVATE>
: vocab-dir+ ( vocab str/f -- path )
[ vocab-name "." split ] dip
[ [ dup peek ] dip append suffix ] when*
[ [ dup last ] dip append suffix ] when*
"/" join ;
: find-vocab-root ( vocab -- path/f )

View File

@ -193,7 +193,7 @@ TUPLE: ambiguous-use-error words ;
: qualified-search ( name manifest -- word/f )
qualified-vocabs>>
(vocab-search) 0 = [ drop f ] [ peek ] if ;
(vocab-search) 0 = [ drop f ] [ last ] if ;
PRIVATE>

View File

@ -40,7 +40,7 @@ SYMBOL: commands
if ;
DEFER: check-status
: quit-game ( vector -- ) drop "you're a quitter" print ;
: quit? ( vector -- t/f ) peek "quit" = ;
: quit? ( vector -- t/f ) last "quit" = ;
: end-game ( vector -- )
dup victory?
[ drop "You WON!" ]

View File

@ -14,4 +14,4 @@ SYMBOL: sleep-period
: set-end ( duration -- end-time ) duration>milliseconds millis + ;
: loop ( quot end -- ) dup millis > [ [ dup call ] dip loop ] [ 2drop ] if ; inline
: animate ( quot duration -- ) reset-progress set-end loop ; inline
: sample ( revs quot -- avg ) reset-progress dupd times progress swap / ; inline
: sample ( revs quot -- avg ) reset-progress dupd times progress swap / ; inline

View File

@ -83,7 +83,7 @@ GENERIC: element-binary-read ( length type -- object )
get-state element>> pop ; inline
: peek-scope ( -- ht )
get-state scope>> peek ; inline
get-state scope>> last ; inline
: read-elements ( -- )
read-element-type
@ -136,7 +136,7 @@ M: bson-not-eoo element-read ( type -- cont? )
read-int32 drop
get-state
[scope-changer] change-scope
scope>> peek ; inline
scope>> last ; inline
M: bson-object element-data-read ( type -- object )
(object-data-read) ;

View File

@ -495,7 +495,7 @@ ERROR: name-error name ;
: fully-qualified ( name -- name )
{
{ [ dup empty? ] [ "." append ] }
{ [ dup peek CHAR: . = ] [ ] }
{ [ dup last CHAR: . = ] [ ] }
{ [ t ] [ "." append ] }
}
cond ;

View File

@ -21,7 +21,7 @@ SYMBOL: tagstack
: closing-tag? ( string -- ? )
[ f ]
[ { [ first CHAR: / = ] [ peek CHAR: / = ] } 1|| ] if-empty ;
[ { [ first CHAR: / = ] [ last CHAR: / = ] } 1|| ] if-empty ;
: <tag> ( name attributes closing? -- tag )
tag new

View File

@ -65,7 +65,7 @@ IRC: rpl-nick-collision "436" nickname : comment ;
PREDICATE: channel-mode < mode name>> first "#&" member? ;
PREDICATE: participant-mode < channel-mode parameter>> ;
PREDICATE: ctcp < privmsg
trailing>> { [ length 1 > ] [ first 1 = ] [ peek 1 = ] } 1&& ;
trailing>> { [ length 1 > ] [ first 1 = ] [ last 1 = ] } 1&& ;
PREDICATE: action < ctcp trailing>> rest "ACTION" head? ;
M: rpl-names post-process-irc-message ( rpl-names -- )

View File

@ -25,7 +25,7 @@ CONSTANT: random-rotation-angle $[ pi 20 / ]
: (random-segments) ( segments n -- segments )
dup 0 > [
[ dup peek random-segment over push ] dip 1- (random-segments)
[ dup last random-segment over push ] dip 1- (random-segments)
] [ drop ] if ;
CONSTANT: default-segment-radius 1

View File

@ -45,7 +45,7 @@ builder "BUILDERS" {
SYMBOLS: host-name target-os target-cpu message message-arg ;
: parse-args ( command-line -- )
dup peek message-arg set
dup last message-arg set
[
{
[ host-name set ]

View File

@ -5,7 +5,7 @@ IN: math.vectors.homogeneous
: (homogeneous-xyz) ( h -- xyz )
1 head* ; inline
: (homogeneous-w) ( h -- w )
peek ; inline
last ; inline
: h+ ( a b -- c )
2dup [ (homogeneous-w) ] bi@ over =

View File

@ -50,7 +50,7 @@ HINTS: count-digits fixnum ;
: (find-unusual-terms) ( n seq -- seq/f )
[ [ arithmetic-terms ] with map ] keep
'[ _ [ peek ] dip member? ] find nip ;
'[ _ [ last ] dip member? ] find nip ;
: find-unusual-terms ( seq -- seq/? )
unclip-slice over (find-unusual-terms) [

View File

@ -75,7 +75,7 @@ INSTANCE: rollover immutable-sequence
] { } make nip ; inline
: most-frequent ( seq -- elt )
frequency-analysis sort-values keys peek ;
frequency-analysis sort-values keys last ;
: crack-key ( seq key-length -- key )
[ " " decrypt ] dip group but-last-slice

View File

@ -41,10 +41,10 @@ IN: project-euler.116
[ length swap - 1- ] keep ?nth 0 or ;
: next ( colortile seq -- )
[ nth* ] [ peek + ] [ push ] tri ;
[ nth* ] [ last + ] [ push ] tri ;
: ways ( length colortile -- permutations )
V{ 1 } clone [ [ next ] 2curry times ] keep peek 1- ;
V{ 1 } clone [ [ next ] 2curry times ] keep last 1- ;
: (euler116) ( length -- permutations )
3 [1,b] [ ways ] with sigma ;

View File

@ -31,7 +31,7 @@ IN: project-euler.117
[ 4 short tail* sum ] keep push ;
: (euler117) ( n -- m )
V{ 1 } clone tuck [ next ] curry times peek ;
V{ 1 } clone tuck [ next ] curry times last ;
PRIVATE>

View File

@ -18,7 +18,7 @@ IN: project-euler.164
<PRIVATE
: next-keys ( key -- keys )
[ peek ] [ 10 swap sum - ] bi [ 2array ] with map ;
[ last ] [ 10 swap sum - ] bi [ 2array ] with map ;
: next-table ( assoc -- assoc )
H{ } clone swap