JohnEarnest / ok

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

oK does not support treating some built-in named verbs as symbols as in K6 #59

Closed darkf closed 4 years ago

darkf commented 7 years ago

In K6 now, sin 3 is an error, it should be `sin 3. oK does not support this.

Furthermore, there is what I believe to be a bug in the current implementation:

 10 sin\5
invalid arguments to \
 10 {sin x}\5
5 -0.9589 -0.8186 -0.7302 -0.667 -0.6186 -0.5799 -0.548 -0.5209 -0.4977 -0.4774

sin and {sin x} should be eta-equivalent.

JohnEarnest commented 7 years ago

Ugh, application of symbols as invocation of the associated named function is an annoying reversal if it's true in general for k6. I had this behavior previously and then took it out.

darkf commented 7 years ago

I don't think it's a general thing -- i.e:

foo:{x}
`foo 3

will be a value error, but

`sin 3

is how you invoke the built-in sin now in K6. Don't you just love arthur's design process, it's almost sinusoidal .:)

JohnEarnest commented 4 years ago

I think for the time being I'm going to stick with "special" named verbs at the parser level. Perhaps I might decide later to go with symbol application like this someday, but it'll be a huge mess to update everything.