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
Is your feature request related to a problem? Please describe.
Currently, it is not possible to use comparison primitives easily. This issue is to discuss ways in which it would be nicer to use, implement, etc.
Describe the solution you'd like
In order to use comparison primitives, this language needs at least one of the following.
Primitive pattern matches
Integer2Boolean conversion
Primitive if primIf (which uses an integer as its condition)
For each of these, implementation of higher level if (n <? 3) then t else f changes a lot.
Primitive pattern matches
The expression would be match n < 3 with 1 -> t; 0 -> f;.
Integer2Boolean conversion
It would be match integer2Boolean (n < 3) with C{1;0} -> t; C{2;0} -> f;
Primitive if primIf
It would be primIf (n < 3) t f
The text was updated successfully, but these errors were encountered:
I think the language needs both primitive pattern matches and the integer2Boolean conversion.
However, the reasons for them are unrelated with each others. For primitive pattern matches, the reason is because it is more preferable to use pattern matching than multi-way ifs, since it should require at most one table-jump, and no more comparison. For the other one, it is the one required to implement if.
FYI: The reason why I think Integer2Boolean is better is that the way makes implementation more consistent. By 'implementation', I mean the ones for if for primitive conditions (like >?, >=?, ...) and for non-primitives (like is_even, is_in, ...). If I implement primIf, then two cases would use different underlying syntaxes after desugaring. (One uses primIf, and the other uses match)
Is your feature request related to a problem? Please describe.
Currently, it is not possible to use comparison primitives easily. This issue is to discuss ways in which it would be nicer to use, implement, etc.
Describe the solution you'd like
In order to use comparison primitives, this language needs at least one of the following.
primIf
(which uses an integer as its condition)For each of these, implementation of higher level
if (n <? 3) then t else f
changes a lot.The expression would be
match n < 3 with 1 -> t; 0 -> f;
.It would be
match integer2Boolean (n < 3) with C{1;0} -> t; C{2;0} -> f;
primIf
It would be
primIf (n < 3) t f
The text was updated successfully, but these errors were encountered: