asteroid
asteroid copied to clipboard
rename the 'in' predicate to 'member'
The in predicate clashes with the in keyword in for loops necessitating the use of excessive parens, e.g.
for (x,y) if x > y in pairlist do
assert(x>y).
end
produces the error,
error: expected 'in' expression in for loop found 'do'.
This is due to the fact that in pairlist is interpreted as part of the conditional pattern
(x,y) if x > y in pairlist
By removing the predicate in this ambiguity will disappear.
The workaround is to put the pattern expression into parentheses,
for ((x,y) if x > y) in pairlist do
assert(x>y).
end
There is no good way to fix this because here the language is inherently ambiguous.