1
0
dust/std/list_functions.ds
2023-11-28 11:38:40 -05:00

24 lines
334 B
Plaintext

find = |items <list> function <fn>| <any> {
for i in items {
if (function i) {
return i
}
}
}
map = |items <list> function <fn>| <list> {
new_list = []
for i in items {
new_list += (function i)
}
new_list
}
foobar <int> = [0 1 2]
-> (map |i <int>| <int> { i - 1 })
-> (find |i <int>| <bool> { i == -1 })
foobar