Due to a simple coding error, :erract can modify the input to FIRSTS, which breaks the promise that lists are immutable. The root of the problem is that lfirsts calls lfirst repeatedly on elements of the input list. This is not correct, it should treat the entire list as a single input. So if it doesn't like the second element, it should say it doesn't like the entire input list, not just the second element.
As a result of this error, using ERRACT can modify the input list. Lists are supposed to be immutable.
I have reproduced this in UCBLogo 6.2.
Steps to Reproduce:
MAKE "mylist [ [] abc ]
MAKE "erract [ [ bad ] ]
SHOW FIRSTS :mylist
SHOW :mylist
What Happens:
The first SHOW prints [bad a], as expected.
The second SHOW prints [[bad] abc].
Expected Result:
The first SHOW prints [bad a].
The second SHOW prints [ [] [abc], which is the value that it was assigned.
This was inadvertently fix by [r6206]. I had started to experiment with a new way of validating input in FIRST, BUTFIRST, LAST, and BUTLAST and didn't realize that it would fix this bug in FIRSTS due to the way FIRSTS calls FIRST. The same change also fixed a similar bug in BUTFIRSTS.
The fix will be available in FMSLogo 8.6.0.
Related
Commit: [r6206]