JohnEarnest / ok

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

fill elements for dyadic function between dicts #82

Closed ktye closed 4 years ago

ktye commented 5 years ago

Currently there are no fill elements, when a dyad is applied between two dicts with dissimilar keys:

A:`a`b  !(1 2)
B:  `b`c!(  3 4)

ok just returns the other element without applying the function. This is not an issue for A+B, but for others such as:

         oK               kx (32bit free version)
A-B  [a:1;b:-1;c:4]       `a`b`c!1 -1 -4
A%B  [a:1;b:0.6667;c:4]   `a`b`c!(1;0.66666667;4)

Is that intended?

JohnEarnest commented 4 years ago

@ktye I think this is behavior that has continued to evolve in k7 and Shakti. oK does what k6 and the earliest versions of k7 did, as far as I recall, but it's not bound to those semantics.

I'm open to more detailed suggestions on the algebra of dictionaries if you have ideas. Closing this issue for now, but feel free to reopen if you want to have a discussion.