Actions
Feature #53
closed[Polysemy]Interpretation goes undetected
Feature #53:
[Polysemy]Interpretation goes undetected
Start date:
Due date:
% Done:
0%
Estimated time:
Platform:
Resolution:
fixed
Triage Stage:
Description
The final line:
Has two possible interpretations and yet is compiled without error or warning.
Seemingly, one possible interpretation goes undetected.
Admittedly my code is weird, certainly i have defied some implicit recommandation that the * operator must be associative, that is of the type ($A,$A) -> $A.
<pre>
define ($A,$A,$B,$B) -> ($A,$B)
($A,$A) -> $A f * ($B,$B) -> $B g
=
($A a1,$A a2,$B b1,$B b2)
|->
(f(a1,a2),g(b1,b2)).
define ($A,$A,$B,$B,$C,$C) -> ($A,$B,$C)
($A,$A) -> $A f * ($B,$B,$C,$C) -> ($B,$C) g
=
($A a1,$A a2,$B b1,$B b2,$C c1,$C c2)
|->
with a = f(a1,a2),
with bc = g(b1,b2,c1,c2),
if bc is (b,c) then
(a,b,c).
define ($A,$A,$B,$B,$C,$C) -> ($A,$B,$C)
($A,$A,$B,$B) -> ($A,$B) f * ($C,$C) -> $C g
=
($A a1,$A a2,$B b1,$B b2,$C c1,$C c2)
|->
with ab = f(a1,a2,b1,b2),
with c = g(c1,c2),
if ab is (a,b) then
(a,b,c).
type Interval($T) :
empty,
between($T lower,$T upper).
define (Interval($T),Interval($T)) -> Interval($T)
intersect(($T,$T) -> Bool less)
=
(Interval($T) a,Interval($T) b)
|->
if a is between(a1,a2) then
if b is between(b1,b2) then
if less(a2,b1) then empty
else if less(b2,a1) then empty
else if less(a1,b1) then between(b1,a2)
else between(a1,b2)
else empty
else empty.
define
(
Interval($A),Interval($A),
Interval($B),Interval($B),
Interval($C),Interval($C)
) ->
(Interval($A),Interval($B),Interval($C))
intersect_triple
(
($A,$A) -> Bool a_less,
($B,$B) -> Bool b_less,
($C,$C) -> Bool c_less
)
=
intersect(a_less) * intersect(b_less) * intersect(c_less).
</pre>
Actions