JohnEarnest / ok

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

New Table Syntax? #29

Closed tjcelaya closed 8 years ago

tjcelaya commented 8 years ago

http://www.kparc.com/d.txt shows +[a:2 3 4;b:abc]as an example for building a table but the repl currently fails withparse error. ']' expected.`

Will this syntax be supported? It doesn't seem to work on k4 so it might be new functionality for +[] but I can't test that.

JohnEarnest commented 8 years ago

I have not implemented k5's kdb features. Currently I don't see them as a high priority, and there isn't exactly abundant information available. There is still quite a bit of work to do on core language features like dmend, curried adverbs and support for date/time types.

tlack commented 8 years ago

I think that's a wise decision.. for now at least! Leave it to secondary implementors.

But: I believe this is just table definition syntax. Surely this, being just a list of dictionaries (flipped) would be handy to use for all manner of operations?

As I've come to internalize table syntax, I find it to be a natural way to represent a surprising amount of things.

So: I agree, don't bother with select. But perhaps this specific lexer trick might be worthwhile.

Just a thought! Thanks again for your tireless work on this badboy.

tjcelaya commented 8 years ago

Not sure if this is true but it was stated on #kq that "[a:...;b:...] in k5 is dictionary syntax" so I would venture to say that's a core language feature.

Hasty reply: the dictionary syntax works, it's the monadic + that fails. My apologies.