More add and add* cleanups
parent
9e96befa69
commit
e75222d039
|
@ -188,7 +188,7 @@ IN: math.intervals.tests
|
||||||
{ max interval-max }
|
{ max interval-max }
|
||||||
}
|
}
|
||||||
"math.ratios.private" vocab [
|
"math.ratios.private" vocab [
|
||||||
{ / interval/ } add
|
{ / interval/ } suffix
|
||||||
] when
|
] when
|
||||||
random ;
|
random ;
|
||||||
|
|
||||||
|
|
|
@ -192,7 +192,7 @@ unit-test
|
||||||
"IN: prettyprint.tests"
|
"IN: prettyprint.tests"
|
||||||
": another-soft-break-layout ( node -- quot )"
|
": another-soft-break-layout ( node -- quot )"
|
||||||
" parse-error-file"
|
" parse-error-file"
|
||||||
" [ <reversed> \"hello world foo\" add ] [ ] make ;"
|
" [ <reversed> \"hello world foo\" suffix ] [ ] make ;"
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
[ t ] [
|
[ t ] [
|
||||||
|
|
|
@ -10,8 +10,8 @@ IN: quotations.tests
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ [ 1 2 3 4 ] ] [ [ 1 2 ] [ 3 4 ] append ] unit-test
|
[ [ 1 2 3 4 ] ] [ [ 1 2 ] [ 3 4 ] append ] unit-test
|
||||||
[ [ 1 2 3 ] ] [ [ 1 2 ] 3 add ] unit-test
|
[ [ 1 2 3 ] ] [ [ 1 2 ] 3 suffix ] unit-test
|
||||||
[ [ 3 1 2 ] ] [ [ 1 2 ] 3 add* ] unit-test
|
[ [ 3 1 2 ] ] [ [ 1 2 ] 3 prefix ] unit-test
|
||||||
|
|
||||||
[ [ "hi" ] ] [ "hi" 1quotation ] unit-test
|
[ [ "hi" ] ] [ "hi" 1quotation ] unit-test
|
||||||
|
|
||||||
|
|
|
@ -61,8 +61,8 @@ ARTICLE: "sequences-access" "Accessing sequence elements"
|
||||||
|
|
||||||
ARTICLE: "sequences-add-remove" "Adding and removing sequence elements"
|
ARTICLE: "sequences-add-remove" "Adding and removing sequence elements"
|
||||||
"Adding elements:"
|
"Adding elements:"
|
||||||
{ $subsection add }
|
{ $subsection prefix }
|
||||||
{ $subsection add* }
|
{ $subsection suffix }
|
||||||
"Removing elements:"
|
"Removing elements:"
|
||||||
{ $subsection remove }
|
{ $subsection remove }
|
||||||
{ $subsection seq-diff } ;
|
{ $subsection seq-diff } ;
|
||||||
|
@ -641,22 +641,22 @@ HELP: push-new
|
||||||
}
|
}
|
||||||
{ $side-effects "seq" } ;
|
{ $side-effects "seq" } ;
|
||||||
|
|
||||||
{ push push-new add add* } related-words
|
{ push push-new prefix suffix } related-words
|
||||||
|
|
||||||
HELP: add
|
HELP: suffix
|
||||||
{ $values { "seq" sequence } { "elt" object } { "newseq" sequence } }
|
{ $values { "seq" sequence } { "elt" object } { "newseq" sequence } }
|
||||||
{ $description "Outputs a new sequence obtained by adding " { $snippet "elt" } " at the end of " { $snippet "seq" } "." }
|
{ $description "Outputs a new sequence obtained by adding " { $snippet "elt" } " at the end of " { $snippet "seq" } "." }
|
||||||
{ $errors "Throws an error if the type of " { $snippet "elt" } " is not permitted in sequences of the same class as " { $snippet "seq1" } "." }
|
{ $errors "Throws an error if the type of " { $snippet "elt" } " is not permitted in sequences of the same class as " { $snippet "seq1" } "." }
|
||||||
{ $examples
|
{ $examples
|
||||||
{ $example "USING: prettyprint sequences ;" "{ 1 2 3 } 4 add ." "{ 1 2 3 4 }" }
|
{ $example "USING: prettyprint sequences ;" "{ 1 2 3 } 4 suffix ." "{ 1 2 3 4 }" }
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
HELP: add*
|
HELP: prefix
|
||||||
{ $values { "seq" sequence } { "elt" object } { "newseq" sequence } }
|
{ $values { "seq" sequence } { "elt" object } { "newseq" sequence } }
|
||||||
{ $description "Outputs a new sequence obtained by adding " { $snippet "elt" } " at the beginning of " { $snippet "seq" } "." }
|
{ $description "Outputs a new sequence obtained by adding " { $snippet "elt" } " at the beginning of " { $snippet "seq" } "." }
|
||||||
{ $errors "Throws an error if the type of " { $snippet "elt" } " is not permitted in sequences of the same class as " { $snippet "seq1" } "." }
|
{ $errors "Throws an error if the type of " { $snippet "elt" } " is not permitted in sequences of the same class as " { $snippet "seq1" } "." }
|
||||||
{ $examples
|
{ $examples
|
||||||
{ $example "USING: prettyprint sequences ;" "{ 1 2 3 } 0 add* ." "{ 0 1 2 3 }" }
|
{ $example "USING: prettyprint sequences ;" "{ 1 2 3 } 0 prefix ." "{ 0 1 2 3 }" }
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
HELP: seq-diff
|
HELP: seq-diff
|
||||||
|
@ -940,7 +940,7 @@ HELP: unclip
|
||||||
{ $values { "seq" sequence } { "rest" sequence } { "first" object } }
|
{ $values { "seq" sequence } { "rest" sequence } { "first" object } }
|
||||||
{ $description "Outputs a tail sequence and the first element of " { $snippet "seq" } "; the tail sequence consists of all elements of " { $snippet "seq" } " but the first." }
|
{ $description "Outputs a tail sequence and the first element of " { $snippet "seq" } "; the tail sequence consists of all elements of " { $snippet "seq" } " but the first." }
|
||||||
{ $examples
|
{ $examples
|
||||||
{ $example "USING: prettyprint sequences ;" "{ 1 2 3 } unclip add ." "{ 2 3 1 }" }
|
{ $example "USING: prettyprint sequences ;" "{ 1 2 3 } unclip suffix ." "{ 2 3 1 }" }
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
HELP: unclip-slice
|
HELP: unclip-slice
|
||||||
|
|
|
@ -11,7 +11,7 @@ IN: sequences.deep.tests
|
||||||
[ { { "foo" } "bar" } t ] [ { { "foo" } "bar" } [ array? ] deep-find* ] unit-test
|
[ { { "foo" } "bar" } t ] [ { { "foo" } "bar" } [ array? ] deep-find* ] unit-test
|
||||||
|
|
||||||
: change-something ( seq -- newseq )
|
: change-something ( seq -- newseq )
|
||||||
dup array? [ "hi" add ] [ "hello" append ] if ;
|
dup array? [ "hi" suffix ] [ "hello" append ] if ;
|
||||||
|
|
||||||
[ { { "heyhello" "hihello" } "hihello" } ]
|
[ { { "heyhello" "hihello" } "hihello" } ]
|
||||||
[ "hey" 1array 1array [ change-something ] deep-map ] unit-test
|
[ "hey" 1array 1array [ change-something ] deep-map ] unit-test
|
||||||
|
|
Loading…
Reference in New Issue