I think that I’ve clearly exposed the problem with Sappho. I’ve spent the last few days struggling with an algorithm for actors to update their p2Values for others. Here’s the algorithm expresssed in Java (I have abbreviated the variables to make reading a little easier:
netMean = p2Value(perceiver, perceivee);
netUncertainty = u2Value(perceiver, perceivee);
for (int i = 1; (i < actorCount); ++i) {
if ((i != perceiver) & (i != perceived)) {
netMean = combinedMeans(netMean, netUncertainty p3Value(perceiver, i, perceivee), u3Value(perceiver, i, perceivee);
netUncertainty = combinedUncertainties(netMean, netUncertainty, p3Value(perceiver, i, perceivee), u3Value(perceiver, i, perceivee);
}
}
Pretty straightforward, no? Actually, there are a few small errors in this, but this communicates the idea of the algorithm: we’re combing the means and uncertainties of the cast. Now, here’s a portion of this looks like in Sappho. This is only a portion; it doesn’t implement the if-test.
Since Sappho doesn’t permit loops, the loop has to be unrolled. and the nesting of the means is not properly echoed with the nesting of the uncertainties.
Look how messy this is! It’s almost indecipherable. What takes 9 lines in Java requires several dozen lines in Sappho. Now, this is because Sappho doesn’t permit looping structures; as a stack-oriented language it would need some serious changes to permit loops to work. It has a number of “implicit loops” that address the great majority of issues, but for this particular issue, Sappho truly sucks.
I shall implement this as a custom operator. That’s the advantage of controlling the source code.