Post Reply 
BUG[?]: ΣLIST, ΠLIST with verrrry short lists
12-24-2015, 08:10 AM (This post was last modified: 12-25-2015 02:38 PM by StephenG1CMZ.)
Post: #3
RE: BUG[?]: ΣLIST, ΠLIST with verrrry short lists
To me, that the summation of a list of strings should concatenate them is not clear - speaking mathematically, I have always thought of summation returning a number rather than a string. Though of course in languages like PPL that concatenate using "+" I can see some logic in the parser considering that option. Not all languages use + to concatenate: Should those languages still concatenate when summing lists of strings (implying summation must behave differently to + for those languages).
If one does restrict summation to summing numbers, when given a string perhaps a language should sum the string lengths, although then it would consistent to use some other concatenation syntax, rather than "+".

Speaking practically, what does a summation of an empty list mean???
If I have a simple program listing how many presents I got from Santa from each friend, it would be convenient to have that program treat an empty list as a 0 (which will hopefully change soon), without having to add a check that the list is nonempty.
Code:
EXPORT SANTA()
BEGIN
  LOCAL PRESENTS:={};
  IF ΣLIST(PRESENTS)=="SANTA ERROR: INVALID DIMENSION" THEN
   MSGBOX("SANTA IS STUCK IN THE CHIMNEY")
  END;
END;
But if I have a program collecting data from a data stream counting meteors, an empty list rather than a count of 0 should return a NaN... We don't know the number because the equipment failed - either because of a flat battery, or because it got destroyed by a bigger meteor than it can count.
(Update: Actually, it depends on the data you are expecting: If you expect a 1 in the data stream for each detection, an empty list represents 0 meteors. If you expect the data stream to ccontainthe number of meteors each minute, an empty list represents either an equipment fault or you haven't yet run it for a minute)
So in practical terms, its not clear what summation of an empty list should return. But it should return a sensible value like 0 or NaN or NULL LIST or NULL STRING, not " Invalid dimension" , which sounds like a program or spacetime failure, not a simple data collection delay in a working program.

Stephen Lewkowicz (G1CMZ)
https://my.numworks.com/python/steveg1cmz
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: BUG[?]: ΣLIST, ΠLIST with verrrry short lists - StephenG1CMZ - 12-24-2015 08:10 AM



User(s) browsing this thread: 3 Guest(s)