mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-06 14:58:50 +00:00
15 lines
306 B
Text
15 lines
306 B
Text
public fun foldl (f, acc, l) {
|
|
-- ^-- (1,19)
|
|
case l of
|
|
{} -> acc
|
|
| x : xs -> foldl (f, f (acc, x), xs)
|
|
-- (5,22)--^ ^-- (5,25)
|
|
esac
|
|
}
|
|
|
|
public fun filter (f, l) {
|
|
case l of
|
|
{} -> {}
|
|
| h : t -> if f (h) then h : filter (f, t) else filter (f, t) fi
|
|
esac
|
|
}
|