3 Container
(require sugar/container) | package: sugar |
Type-neutral functions for getting elements out of a container, or testing membership.
procedure
container : (or/c list? vector? sequence? dict? string? symbol? path?) which : any/c end_which : (or/c (and/c integer? positive?) #f) = #f
Examples: | |||||
|
For other container types — which are all sequence-like — retrieve the element located at which. Or if the optional end_which argument is provided, retrieve the elements from which to (sub1 end_which), inclusive (i.e., make a slice). Raise an error if which or end_which is out of bounds.
Examples: | |||||||||||||||||||||
|
When container is a path, it’s treated as a list of exploded path elements, not as a stringlike value.
Examples: | ||||
|
To slice to the end of container, use (len container) as the value of end_which.
Examples: | ||||||||||||
|
Examples: | ||||||||||||||
|
As with get, when container is a path, it’s treated as a list of exploded path elements, not as a stringlike value.
Examples: | ||||
|