Ticket #53 (closed enhancement: fixed)
[Polysemy]Interpretation goes undetected
| Reported by: | SpiceGuid | Owned by: | alp |
|---|---|---|---|
| Priority: | none | Milestone: | |
| Component: | Design | Version: | 1.9.0.4 |
| Severity: | feature | Keywords: | |
| Cc: | Platform: | All | |
| Working progress: | Not started | Blocking / Referer: |
Description
The final line:
intersect(a_less) * intersect(b_less) * intersect(c_less).
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.
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).
Change History
Note: See
TracTickets for help on using
tickets.
