Closed refi64 closed 9 years ago
Looks like the oK bug is simply for the case where you're trying to "take" from an empty list. Should be a straightforward fix.
The official K5 interpreter produces a few surprising results, mainly the behavior for 3#""
:
3#""
" "
3#()
("";"";"")
3#0N
0N 0N 0N
I believe it goes like this (in a Python-like pseudocode):
a (#) b =
if a > len(b)
if b == "" then return 'a' spaces
else return b repeated 'a' times
else take a elements from b
Fixed the surface level problem. As mentioned in the commit, the special case for strings will have to wait, since oK presently does not carry type information along with vectors- a zero length vector is just a zero-length vector:
0#""
()
5#""
(()
()
()
()
())
Just try:
It gives: