JohnEarnest / ok

An open-source interpreter for the K5 programming language.
MIT License
587 stars 72 forks source link

assignment using empty list as index gives back index error #37

Closed andrey-vyatkin closed 8 years ago

andrey-vyatkin commented 8 years ago
x:!5;x[,()]:0;x

in original k4 this line returns back correct result (0 1 2 3 4, to be precise) in oK, index error is given back

full trace:

  x[,()]:0
index error.
Error: index error.
    at dmend (http://johnearnest.github.io/ok/oK.js:639:47)
    at dmend (http://johnearnest.github.io/ok/oK.js:638:21)
    at mend (http://johnearnest.github.io/ok/oK.js:619:68)
    at dmend4 (http://johnearnest.github.io/ok/oK.js:615:37)
    at applyverb (http://johnearnest.github.io/ok/oK.js:453:32)
    at run (http://johnearnest.github.io/ok/oK.js:580:53)
    at run (http://johnearnest.github.io/ok/oK.js:589:46)
    at run (http://johnearnest.github.io/ok/oK.js:578:45)
    at processLine (http://johnearnest.github.io/ok/index.html:334:31)
    at HTMLTextAreaElement.processInput (http://johnearnest.github.io/ok/index.html:237:28)
JohnEarnest commented 8 years ago

Confirmed, in k5 the behavior should be the same as k4:

 x:!5;x[,()]:0;x
0 1 2 3 4