Ampersand
Ampersand copied to clipboard
Error in the operator #
What happened
I noticed that
RELATION r[A*B]
ENFORCE r := I[A]#"foo"
has a different semantics than
RELATION r[A*B]
ENFORCE r := V[A*B]#"foo"
If I test this with the following population:
POPULATION A CONTAINS [ "1", "2", "3" ]
POPULATION B CONTAINS [ "foo", "bar", "gnu" ]
I see that the expression I[A]#"foo"
yields [("1","foo"),("1","bar"),("1","gnu"),("2","foo"),("2","bar"),("2","gnu"),("3","foo"),("3","bar"),("3","gnu")]
.
Yet, the expression V[A*B]#"foo"
yields [("1","foo"),("2","foo"),("3","foo")]
.
What I expected
I expected the result to be the same, i.e. [("1","foo"),("2","foo"),("3","foo")]
, in both cases to comply with the definition of #
.
Version of ampersand that was used
I used a dockerfile FROM ampersandtarski/prototype-framework:v1.14
Steps to reproduce
- Run the script below as a prototype (e.g. in
https://rap.cs.ou.nl
) and observe the results for the termV[A*B]#"foo"
. - Move the comment, rerun, and observe the results for the term
I[A]#"foo"
.
Screenshot / Video
Context / Source of ampersand script
CONTEXT Issue1460
RELATION r[A*B]
-- ENFORCE r := I[A]#"foo"
ENFORCE r := V[A*B]#"foo"
POPULATION A CONTAINS [ "1", "2", "3" ]
POPULATION B CONTAINS [ "foo", "bar", "gnu" ]
INTERFACE ShowAll : "_SESSION";I[SESSION] BOX
[ As : V[SESSION*A] BOX
[ A : I
, "B (r)" : r
]
, Bs : V[SESSION*B] BOX
[ B : I
, "A (r~)" : r~
]
]
ENDCONTEXT