1 IN: persistent.sequences
2 USING: help.markup help.syntax math sequences kernel ;
5 { $values { "val" object } { "i" integer } { "seq" sequence } { "seq'" sequence } }
6 { $contract "Persistent analogue of " { $link set-nth } ". Outputs a new sequence with the " { $snippet "i" } "th element replaced by " { $snippet "val" } "." } ;
9 { $values { "val" object } { "seq" sequence } { "seq'" sequence } }
10 { $contract "Persistent analogue of " { $link push } ". Outputs a new sequence with all elements of " { $snippet "seq" } " together with " { $snippet "val" } " added at the end." } ;
13 { $values { "seq" sequence } { "seq'" sequence } }
14 { $contract "Persistent analogue of " { $link pop* } ". Outputs a new sequence with all elements of " { $snippet "seq" } " except for the final element." } ;
16 ARTICLE: "persistent.sequences" "Persistent sequence protocol"
17 "The persistent sequence protocol consists of the non-mutating sequence protocol words, such as " { $link length } " and " { $link nth } ", together with the following operations:"
18 { $subsection new-nth }
21 "The default implementations of the above run in " { $snippet "O(n)" } " time; the " { $vocab-link "persistent.vectors" } " vocabulary provides an implementation of these operations in " { $snippet "O(1)" } " time." ;
23 ABOUT: "persistent.sequences"