Enable creating a list listeral that contains the empty word
A Logo programming environment for Microsoft Windows
Brought to you by:
david_costanzo
It should be possible to have a list/array literal that contains the empty word. The most natural way would be using vertical bars
SHOW COUNT [ || ]
In MSWLogo 6.5b and FMSLogo 8.4.0, the above prints 0, as the list is empty. In UCBLogo 6.2.3, it prints 1, because [ || ] is the list that contains the empty word.
This was reported by Daniel Ajoy on the Discussion Forum.
Discussion: 2b179e531f
Discussion: no way to literally express an empty word in a list
Using lists in FMSLogo (and Logo at all) is complicated, but rewarding. I'd explain the above mentioned phenomenon to myself in the following way: The list literal [...] is literal in a wysiwyg sense - you must not put something inside that is still to be evaluated to get the final form. For example, if you write :x between the brackets, you get what you see literally and not any result of an evaluation. But if you use the operator LIST :x :y, you expect that there is some content to be found as a result of an evaluation. Of course, the procedure LIST may contain literals, too, but the bracket list [...] must not contain things to be still evaluated. So - what about | |? The two vertical bars do something: they enclose nothingness, and you have to remove them, if you want pure nirwana as final result. Removing the vertical bars is an evaluation. Consequently, the || is something to be still evaluated and so doesn't belong into literal lists - okay, list literals. I think, now everything is completely clear - FMSLogo does it right.
After this is implemented, some of the test code can be cleaned up. This is in predicate.lgo because there's no support for literals