21 lines
255 B
Plaintext
21 lines
255 B
Plaintext
find = |list function| => {
|
|
for i in list {
|
|
if (function i) {
|
|
return i
|
|
}
|
|
}
|
|
}
|
|
|
|
map = |list function| => {
|
|
new_list = []
|
|
|
|
for i in list {
|
|
new_list += (function i)
|
|
}
|
|
|
|
new_list
|
|
}
|
|
|
|
[0 1 2] -> (map |i| => { i - 1})
|
|
-> (find |i| => { i == 1 })
|