Relevance Question - Plural Tuples - Sum of .. does not work at a particular situation

Hello,

I’m having the following situation -

On Fixlet Debugger:

// Multiple Tuple
q: ((59, 553);(4, 3587))
A: 59, 553
A: 4, 3587
T: 3.764 ms
I: plural ( integer, integer )

// Sum of the First Items
q: sum of items 0 of ((59, 553);(4, 3587))
A: 63
T: 3.093 ms
I: singular integer

// Sum of the Second Items
q: sum of items 1 of ((59, 553);(4, 3587))
A: 4140
T: 2.318 ms
I: singular integer

// Putting them together in a Tuple
q: (sum of items 0 of ((59, 553);(4, 3587)), sum of items 1 of ((59, 553);(4, 3587)))
A: 63, 4140
T: 1.533 ms
I: singular ( integer, integer )

On The Fixlet Debugger, works correctly…

On Session Relevance , the Sum does not works… I will explain…

(item 3 of it, item 4 of it) of SOME-SESSION-RELEVANCE
Returns Multiple Tuples
59, 553
4, 3587

sum of (items 0 of it) of (item 3 of it , item 4 of it) of SOME-SESSION-RELEVANCE
63

sum of (items 1 of it) of (item 3 of it , item 4 of it) of SOME-SESSION-RELEVANCE
4140

This is the Issue -
(sum of (items 0 of it), sum of (items 1 of it)) of (item 3 of it , item 4 of it) of SOME-SESSION-RELEVANCE
59, 553
4, 3587

It may be hard to say where the issue is, without seeing the full relevance, but one thing that stands out to me is that in your first case

q: (sum of items 0 of ((59, 553);(4, 3587)) )

each ‘sum of items’ is taking a plural, the sum is operating across all of those.
In your session relevance form, you have it more like

q: (sum of items 0 of it) of ((59, 553);(4, 3587)) 

With the parentheses grouped that way, you actually enter ‘sum of items 0 of it’ twice. The first time ‘item 0 of it’ is just 59, so the sum of 59 gives a first result of 59. The second time into the loop, ‘item 0 of it’ is 4, and the sum of “just 4” is 4. So this part would give two answers, ‘59’ and ‘4’, instead of summing them together,

To make your Session Relevance look like your Client Relevance, you’d have to do something convoluted like

(sum of items 0  of (item 3 of it , item 4 of it) of SOME-SESSION-RELEVANCE, sum of items 1  of (item 3 of it , item 4 of it) of SOME-SESSION-RELEVANCE )

Depending on what you’re doing that can get very expensive.
I’m not sure whether we even have a good construct for summing two different items at once.

Depending on what SOME-SESSION-RELEVANCE does, you may be able to put the answers into Sets and then loop through ‘sum of elements of set’.

2 Likes

neat solve, Jason!

I think the core issue here is that items 0 of does not give what we think it is giving. (Comma vs semicolon in the examples.

q: (items 0 of it) of (item 3 of it , item 4 of it) of (true, true, true,(59, 553),(4,3587))
A: 59, 553

but this does in both session and in client
q: (sum of items 0 of (item 3 of it ; item 4 of it), sum of items 1 of (item 3 of it; item 4 of it)) of (true, true,true,(59, 553),(4,3587))
A: 63, 4140

Notice also that both Jason an I built a placeholder for SOME-SESSION-RELEVANCE to demonstrate - good for “test harness”

1 Like

Thank you all !
I’ll try it later and update with the results!

In the end, I’ve used the following option:

(sum of items 0 of (item 3 of it , item 4 of it) of SOME-SESSION-RELEVANCE, sum of items 1 of (item 3 of it , item 4 of it) of SOME-SESSION-RELEVANCE )

Yes the session relevance takes more time to complete and I will need to optimize it. But it does get the answer I needed.

1 Like