You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use unification in type inference pass to bind targets and types
Unfold multiple assignments in code gen pass
TODO when structs and anonymous structs / tuples are implemented:
x = ("the", 1720512, true)
(token, count, is_stopword) = x
print(token)
# or using struct
struct MyType(token, count, is_stopword)
x = MyType("the", 1720512, true)
(token, count, is_stopword) = x
print(token)
TODO when exceptions are implemented:
x = [1,2,3]
[a, 2, c] = x # a=1, c=3
[a, 5, c] = x # raises pattern match exception
Keep in mind future usage in match construct:
x = ("the", 1720512, true)
match x:
case (token, count, true):
print("Matched stopword: " + token)
case (token, count, false):
print("Matched non-stopword: " + token)
end
# and possible an expression flavor:
x = ("the", 1720512, true)
message = match x:
case (token, count, true):
"Matched stopword: " + token
case (token, count, false):
"Matched non-stopword: " + token
end
The text was updated successfully, but these errors were encountered:
Implement Erlang/Prolog/Elixir style pattern matching on complex types, e.g.
Tasks:
TODO when structs and anonymous structs / tuples are implemented:
TODO when exceptions are implemented:
Keep in mind future usage in match construct:
The text was updated successfully, but these errors were encountered: