treelist_util
import: treelist_util | package: treelist-util |
List operations matching racket/list that aren’t in Rhombus List.
> List.index_of([2, 4, 5, 8], 5)
2
> List.index_of([2, 4, 5, 8], 6)
#false
function | |
|
> List.index_where([2, 4, 5, 8], is_odd)
2
> List.index_where([2, 4, 5, 8], is_negative)
#false
function | |
|
> List.splitf([2, 4, 5, 8], is_even)
[2, 4]
[5, 8]
> List.append_all([["a", "b"], ["c", ["d"], "e"], []])
["a", "b", "c", ["d"], "e"]
> List.flatten([["a"], "b", ["c", ["d", "e"], []]])
["a", "b", "c", "d", "e"]
> List.flatten("a")
["a"]
> List.cartesian_product([1, 2, 3], ["a", "b", "c"])
[
[1, "a"],
[1, "b"],
[1, "c"],
[2, "a"],
[2, "b"],
[2, "c"],
[3, "a"],
[3, "b"],
[3, "c"]
]
> List.cartesian_product_all([[4, 5, 6], ["d", "e", "f"], [#true, #false]])
[
[4, "d", #true],
[4, "d", #false],
[4, "e", #true],
[4, "e", #false],
[4, "f", #true],
[4, "f", #false],
[5, "d", #true],
[5, "d", #false],
[5, "e", #true],
[5, "e", #false],
[5, "f", #true],
[5, "f", #false],
[6, "d", #true],
[6, "d", #false],
[6, "e", #true],
[6, "e", #false],
[6, "f", #true],
[6, "f", #false]
]