1 ! Copyright (C) 2009 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: help.markup help.syntax kernel quotations classes sequences ;
4 IN: splitting.monotonic
6 HELP: monotonic-split-slice
8 { "seq" sequence } { "quot" { $quotation ( obj1 obj2 -- ? ) } }
9 { "pieces" "a sequence of slices" }
11 { $description "Monotonically splits a sequence into slices." }
14 "USING: splitting.monotonic math prettyprint ;"
15 "{ 1 2 3 2 3 4 } [ < ] monotonic-split-slice ."
17 T{ slice { to 3 } { seq { 1 2 3 2 3 4 } } }
18 T{ slice { from 3 } { to 6 } { seq { 1 2 3 2 3 4 } } }
25 { "seq" sequence } { "quot" quotation }
26 { "pieces" "a sequence of sequences" }
28 { $description "Monotonically splits a sequence." }
31 "USING: splitting.monotonic math prettyprint ;"
32 "{ 1 2 3 2 3 4 } [ < ] monotonic-split ."
33 "{ { 1 2 3 } { 2 3 4 } }"
40 { "slices" "a sequence of downward-slices" }
42 { $description "Returns an array of monotonically decreasing slices of type " { $link downward-slice } ". Slices of one element are discarded." } ;
47 { "slices" "a sequence of stable-slices" }
49 { $description "Returns an array of monotonically decreasing slices of type " { $link downward-slice } ". Slices of one element are discarded." } ;
54 { "slices" "a sequence of upward-slices" }
56 { $description "Returns an array of monotonically increasing slices of type " { $link downward-slice } ". Slices of one element are discarded." } ;
61 { "slices" "a sequence of downward, stable, and upward slices" }
63 { $description "Returns a sorted sequence of downward, stable, or upward slices. The endpoints of some slices may overlap with each other." }
66 "USING: splitting.monotonic math prettyprint ;"
67 "{ 1 2 3 3 2 1 } trends ."
69 T{ upward-slice { to 3 } { seq { 1 2 3 3 2 1 } } }
73 { seq { 1 2 3 3 2 1 } }
78 { seq { 1 2 3 3 2 1 } }
84 ARTICLE: "splitting.monotonic" "Splitting trending sequences"
85 "The " { $vocab-link "splitting.monotonic" } " vocabulary splits sequences that are trending downwards, upwards, or stably." $nl
86 "Splitting into sequences:"
87 { $subsections monotonic-split }
88 "Splitting into slices:"
89 { $subsections monotonic-split-slice }
98 ABOUT: "splitting.monotonic"