Merge branch 'master' of git://factorcode.org/git/factor

release
Daniel Ehrenberg 2007-10-12 15:55:02 -05:00
commit 85e2d364ee
13 changed files with 21 additions and 21 deletions

View File

@ -53,7 +53,7 @@ M: effect clone
[ effect-in clone ] keep effect-out clone <effect> ;
: split-shuffle ( stack shuffle -- stack1 stack2 )
effect-in length swap cut* ;
effect-in length cut* ;
: load-shuffle ( stack shuffle -- )
effect-in [ set ] 2each ;

View File

@ -296,7 +296,7 @@ M: phantom-retainstack finalize-height
GENERIC: cut-phantom ( n phantom -- seq )
M: phantom-stack cut-phantom
[ delegate cut* swap ] keep set-delegate ;
[ delegate swap cut* swap ] keep set-delegate ;
: phantom-append ( seq stack -- )
over length over adjust-phantom push-all ;

View File

@ -120,7 +120,7 @@ SYMBOL: ->
: remove-breakpoints ( quot pos -- quot' )
over quotation? [
1+ swap cut [ (remove-breakpoints) ] 2apply
1+ cut [ (remove-breakpoints) ] 2apply
[ -> ] swap 3append
] [
drop

View File

@ -904,17 +904,17 @@ HELP: tail?
{ delete-nth remove delete } related-words
HELP: cut-slice
{ $values { "n" "a non-negative integer" } { "seq" sequence } { "before" sequence } { "after" "a slice" } }
{ $values { "seq" sequence } { "n" "a non-negative integer" } { "before" sequence } { "after" "a slice" } }
{ $description "Outputs a pair of sequences, where " { $snippet "before" } " consists of the first " { $snippet "n" } " elements of " { $snippet "seq" } " and has the same type, while " { $snippet "after" } " is a slice of the remaining elements." }
{ $notes "Unlike " { $link cut } ", the run time of this word is proportional to the length of " { $snippet "before" } ", not " { $snippet "after" } ", so it is suitable for use in an iterative algorithm which cuts successive pieces off a sequence." } ;
HELP: cut
{ $values { "n" "a non-negative integer" } { "seq" sequence } { "before" sequence } { "after" sequence } }
{ $values { "seq" sequence } { "n" "a non-negative integer" } { "before" sequence } { "after" sequence } }
{ $description "Outputs a pair of sequences, where " { $snippet "before" } " consists of the first " { $snippet "n" } " elements of " { $snippet "seq" } ", while " { $snippet "after" } " holds the remaining elements. Both output sequences have the same type as " { $snippet "seq" } "." }
{ $notes "Since this word copies the entire tail of the sequence, it should not be used in a loop. If this is important, consider using " { $link cut-slice } " instead, since it returns a slice for the tail instead of copying." } ;
HELP: cut*
{ $values { "n" "a non-negative integer" } { "seq" sequence } { "before" sequence } { "after" sequence } }
{ $values { "seq" sequence } { "n" "a non-negative integer" } { "before" sequence } { "after" sequence } }
{ $description "Outputs a pair of sequences, where " { $snippet "after" } " consists of the last " { $snippet "n" } " elements of " { $snippet "seq" } ", while " { $snippet "before" } " holds the remaining elements. Both output sequences have the same type as " { $snippet "seq" } "." } ;
HELP: start*

View File

@ -604,14 +604,14 @@ M: sequence <=>
tuck length tail-slice* sequence=
] if ;
: cut-slice ( n seq -- before after )
swap [ head ] 2keep tail-slice ;
: cut-slice ( seq n -- before after )
[ head ] 2keep tail-slice ;
: cut ( n seq -- before after )
swap [ head ] 2keep tail ;
: cut ( seq n -- before after )
[ head ] 2keep tail ;
: cut* ( n seq -- before after )
swap [ head* ] 2keep tail* ;
: cut* ( seq n -- before after )
[ head* ] 2keep tail* ;
<PRIVATE

View File

@ -30,7 +30,7 @@ M: tuple class class-of-tuple ;
swap [ index ] curry map ;
: reshape-tuple ( oldtuple permutation -- newtuple )
>r tuple>array 2 swap cut r>
>r tuple>array 2 cut r>
[ [ swap ?nth ] [ drop f ] if* ] curry* map
append (>tuple) ;

View File

@ -33,7 +33,7 @@ PRIVATE>
: >base64 ( seq -- base64 )
#! cut string into two pieces, convert 3 bytes at a time
#! pad string with = when not enough bits
[ length dup 3 mod - ] keep cut swap
dup length dup 3 mod - swap
[
3 group [ encode3 % ] each
dup empty? [ drop ] [ >base64-rem % ] if

View File

@ -113,7 +113,7 @@ M: f print-element drop ;
"Examples" $heading print-element ;
: $example ( element -- )
1 swap cut* swap "\n" join dup <input> [
1 cut* swap "\n" join dup <input> [
input-style get format nl print-element
] ($code) ;

View File

@ -11,7 +11,7 @@ IN: io.sniffer.filter.bsd
"long" heap-size 1- [ + ] keep bitnot bitand ;
M: unix-io packet. ( string -- )
18 swap cut swap >byte-array bpfh.
18 cut swap >byte-array bpfh.
(packet.) ;
M: unix-io sniffer-loop ( stream -- )

View File

@ -77,7 +77,7 @@ SYMBOL: irc-client
trim-: "!" split first ;
: irc-split ( string -- seq )
1 swap [ [ CHAR: : = ] find* ] keep
swap [ cut trim-: ] [ nip f ] if >r [ blank? ] trim trim-:
swap [ swap cut trim-: ] [ nip f ] if >r [ blank? ] trim trim-:
" " split r> [ 1array append ] when* ;
: me? ( name -- ? )
irc-client get irc-client-nick nick-name = ;

View File

@ -34,7 +34,7 @@ linkname magic version uname gname devmajor devminor prefix ;
155 read-c-string* over set-tar-header-prefix ;
: header-checksum ( seq -- x )
148 swap cut-slice 8 tail-slice
148 cut-slice 8 tail-slice
[ 0 [ + ] reduce ] 2apply + 256 + ;
TUPLE: checksum-error ;

View File

@ -98,7 +98,7 @@ PRIVATE>
2dup nth \ break = [
nip
] [
>r 1+ r> cut [ break ] swap 3append
swap 1+ cut [ break ] swap 3append
] if
] (step) ;
@ -107,7 +107,7 @@ PRIVATE>
: step-into ( interpreter -- )
[
cut [
swap cut [
swap % unclip literalize , \ (step-into) , %
] [ ] make
] (step) ;

View File

@ -93,7 +93,7 @@ M: closer process
: make-xml-doc ( prolog seq -- xml-doc )
dup [ tag? ] find
>r assure-tags swap cut 1 tail
>r assure-tags cut 1 tail
no-pre/post no-post-tags
r> swap <xml> ;