-
-
Notifications
You must be signed in to change notification settings - Fork 888
Labels
Description
pub fn collapse(id, events) {
case events {
[] -> False
[_, ..rest] -> collapse_thinking(id, rest)
}
}
pub fn collapse_thinking(id, events) {
case events {
[] -> True
[1, ..rest] -> collapse(id, rest)
[_, ..rest] -> collapse_checking(id, rest)
}
}
pub fn collapse_checking(id, events) {
case events {
[] -> True
[1, ..rest] -> collapse_running(id, rest)
[_, ..rest] -> collapse_thinking(id, rest)
}
}
pub fn collapse_running(id, _events) {
echo "running"
echo id
let #(a, b) = id
echo a
echo b
echo "done"
False
}
pub fn main() {
echo "start"
collapse(#("a", "b"), [1,2,1])
collapse(2, [1,2,1])
}This collapse function should only accept a tuple. The second call in main also type checks, and the program crashes on the line let #(a,b) = id