Funny behavior of map with strings and attachments…

map(foo;debug-term(|"x"));debug-term(|"y")

19:47 | INFO  | stderr- x: Occurrence(Namespace("DontCareNs"),"children",TermIndex("eclipse:///debug/debug.ice2",51)): children
19:47 | INFO  | stderr- x: "No Occurence": parent
19:47 | INFO  | stderr- y: [Occurrence(Namespace("DontCareNs"),"children",TermIndex("eclipse:///debug/debug.ice2",31)),"No Occurence"]: ["children","parent"{"n1"}]

Note the 51 and 31, I expected 51 twice.

and filter instead of map:

filter(foo;debug-term(|"x"));debug-term(|"y")

19:51 | INFO  | stderr- x: Occurrence(Namespace("DontCareNs"),"children",TermIndex("eclipse:///debug/debug.ice2",51)): children
19:51 | INFO  | stderr- x: "No Occurence": parent
19:51 | INFO  | stderr- y: [Occurrence(Namespace("DontCareNs"),"children",TermIndex("eclipse:///debug/debug.ice2",51)),"No Occurence"]: ["children","parent"{"n1"}]

Note the 51 and 51, which is the expected behavior.

debug-term reads attachment on strings:

debug-term(|info) = where(is-list);debug(|$[[info]: [<map(nabl2-mk-occurrence(|"DontCareNs")<+!"No Occurence");write-to-string>]])
debug-term(|info) =                debug(|$[[info]: [<   (nabl2-mk-occurrence(|"DontCareNs")<+!"No Occurence");write-to-string>]])
Submitted by Daco Harkes on 28 September 2016 at 19:56

On 28 September 2016 at 20:10 Daco Harkes commented:

No worries, filter can do this as well

memberValueNames := <filter(entityinstancename-get-membervaluename-inv(|eiName);debug-term(|"x"));debug-term(|"y")>relRoleInvNames;

20:10 | INFO  | stderr                         - x: Occurrence(Namespace("DontCareNs"),"part",TermIndex("eclipse:///debug/debug.ice2",186)): part
20:10 | INFO  | stderr                         - x: Occurrence(Namespace("DontCareNs"),"project",TermIndex("eclipse:///debug/debug.ice2",192)): project
20:10 | INFO  | stderr                         - x: Occurrence(Namespace("DontCareNs"),"supplier",TermIndex("eclipse:///debug/debug.ice2",180)): supplier
20:10 | INFO  | stderr                         - y: [Occurrence(Namespace("DontCareNs"),"part",TermIndex("eclipse:///debug/debug.ice2",67)),Occurrence(Namespace("DontCareNs"),"project",TermIndex("eclipse:///debug/debug.ice2",72)),Occurrence(Namespace("DontCareNs"),"supplier",TermIndex("eclipse:///debug/debug.ice2",62))]: ["part","project","supplier"]

Expected numbers 186, 192, and 180, but got 67, 72 and 62.


On 28 September 2016 at 20:45 Daco Harkes commented:

Expected behavior: map and filter construct lists of the strings with the attachments.

Actual behavior: map and filter construct lists of equal strings with different attachments. (term-sharing behavior?)

The number in the TermIndex(_,_) constructor in the above examples is stored in an attachment.

Log in to post comments