JohnEarnest / ok

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

possibly a bug involving each-reduce #27

Closed ngn closed 8 years ago

ngn commented 8 years ago
 ,'/(0 1 2;3 4 5)
(,[0 1 2;];,[3 4 5;])

I was expecting

(0 3;1 4;2 5)
JohnEarnest commented 8 years ago

Is your expected output a typo? I don't see how this could result in a 6 at all. k5 produces the following:

 ,'/(0 1 2;3 4 5)
(0 3;1 4;2 5)

k2 produces the same result. Kona does something similar to oK's current behavior, so this may be an issue for them as well. It seems that I am calculating the valence of the verb train ,' improperly during adverb dispatch. I think "each" actually needs special treatment for this case.

ngn commented 8 years ago

Yep, it was a typo. Sorry. Corrected.

JohnEarnest commented 8 years ago

No problem- I just wanted to make sure I wasn't missing something. I think I have resolved this issue with https://github.com/JohnEarnest/ok/commit/aa151cea82e16528952c75279cfbc2c7ad8057af . As always, thanks for bringing oK bugs to my attention!

As I mentioned earlier, you may want to file a bug report with the Kona maintainers as well, since this treatment of "each" is apparently as old as K2 and thus is likely a compatibility issue for them.