fix typo in grouping docs, add more examples
							parent
							
								
									67c37de79c
								
							
						
					
					
						commit
						7f218dde57
					
				|  | @ -29,8 +29,7 @@ ABOUT: "grouping" | ||||||
| HELP: groups | HELP: groups | ||||||
| { $class-description "Instances are virtual sequences whose elements are disjoint fixed-length subsequences of an underlying sequence. Groups are mutable and resizable if the underlying sequence is mutable and resizable, respectively." | { $class-description "Instances are virtual sequences whose elements are disjoint fixed-length subsequences of an underlying sequence. Groups are mutable and resizable if the underlying sequence is mutable and resizable, respectively." | ||||||
| $nl | $nl | ||||||
| "New groups are created by calling " { $link <groups> } " and " { $link <sliced-groups> } "." } | "New groups are created by calling " { $link <groups> } " and " { $link <sliced-groups> } "." } ; | ||||||
| { $see-also group } ; |  | ||||||
| 
 | 
 | ||||||
| HELP: group | HELP: group | ||||||
| { $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "array" "a sequence of sequences" } } | { $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "array" "a sequence of sequences" } } | ||||||
|  | @ -48,11 +47,16 @@ HELP: <groups> | ||||||
|         "USING: arrays kernel prettyprint sequences grouping ;" |         "USING: arrays kernel prettyprint sequences grouping ;" | ||||||
|         "9 >array 3 <groups> dup reverse-here concat >array ." "{ 6 7 8 3 4 5 0 1 2 }" |         "9 >array 3 <groups> dup reverse-here concat >array ." "{ 6 7 8 3 4 5 0 1 2 }" | ||||||
|     } |     } | ||||||
|  |     { $example | ||||||
|  |         "USING: kernel prettyprint sequences grouping ;" | ||||||
|  |         "{ 1 2 3 4 5 6 } 3 <groups> 0 swap nth ." | ||||||
|  |         "{ 1 2 3 }" | ||||||
|  |     } | ||||||
| } ; | } ; | ||||||
| 
 | 
 | ||||||
| HELP: <sliced-groups> | HELP: <sliced-groups> | ||||||
| { $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "groups" groups } } | { $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "groups" groups } } | ||||||
| { $description "Outputs a virtual sequence whose elements are overlapping subsequences of " { $snippet "n" } " elements from the underlying sequence." } | { $description "Outputs a virtual sequence whose elements are slices of disjoint subsequences of " { $snippet "n" } " elements from the underlying sequence." } | ||||||
| { $examples | { $examples | ||||||
|     { $example |     { $example | ||||||
|         "USING: arrays kernel prettyprint sequences grouping ;" |         "USING: arrays kernel prettyprint sequences grouping ;" | ||||||
|  | @ -60,6 +64,11 @@ HELP: <sliced-groups> | ||||||
|         "dup [ reverse-here ] each concat >array ." |         "dup [ reverse-here ] each concat >array ." | ||||||
|         "{ 2 1 0 5 4 3 8 7 6 }" |         "{ 2 1 0 5 4 3 8 7 6 }" | ||||||
|     } |     } | ||||||
|  |     { $example | ||||||
|  |         "USING: kernel prettyprint sequences grouping ;" | ||||||
|  |         "{ 1 2 3 4 5 6 } 3 <sliced-groups> 1 swap nth ." | ||||||
|  |         "T{ slice { from 3 } { to 6 } { seq { 1 2 3 4 5 6 } } }" | ||||||
|  |     } | ||||||
| } ; | } ; | ||||||
| 
 | 
 | ||||||
| HELP: clumps | HELP: clumps | ||||||
|  | @ -89,11 +98,23 @@ HELP: <clumps> | ||||||
|         "share-price 4 <clumps> [ [ sum ] [ length ] bi / ] map ." |         "share-price 4 <clumps> [ [ sum ] [ length ] bi / ] map ." | ||||||
|         "{ 113/400 167/400 201/400 241/400 243/400 91/200 1/4 }" |         "{ 113/400 167/400 201/400 241/400 243/400 91/200 1/4 }" | ||||||
|     } |     } | ||||||
|  |     { $example | ||||||
|  |         "USING: kernel sequences grouping prettyprint ;" | ||||||
|  |         "{ 1 2 3 4 5 6 } 3 <clumps> 1 swap nth ." | ||||||
|  |         "{ 2 3 4 }" | ||||||
|  |     } | ||||||
| } ; | } ; | ||||||
| 
 | 
 | ||||||
| HELP: <sliced-clumps> | HELP: <sliced-clumps> | ||||||
| { $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "clumps" clumps } } | { $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "clumps" clumps } } | ||||||
| { $description "Outputs a virtual sequence whose elements are overlapping slices of " { $snippet "n" } " elements from the underlying sequence." } ; | { $description "Outputs a virtual sequence whose elements are overlapping slices of " { $snippet "n" } " elements from the underlying sequence." } | ||||||
|  | { $examples | ||||||
|  |     { $example | ||||||
|  |         "USING: kernel sequences grouping prettyprint ;" | ||||||
|  |         "{ 1 2 3 4 5 6 } 3 <sliced-clumps> 1 swap nth ." | ||||||
|  |         "T{ slice { from 1 } { to 4 } { seq { 1 2 3 4 5 6 } } }" | ||||||
|  |     } | ||||||
|  | } ; | ||||||
| 
 | 
 | ||||||
| { clumps groups } related-words | { clumps groups } related-words | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue