← Back to context

Comment by vidarh

10 years ago

It is, but the little I've seen of K implies that it's small size comes from a combination of two things:

1) A standard library / set of operators that are a very good fit for the typical domains it works on.

2) Minimizing symbol length.

E.g. I translated one example I saw into Ruby, and ended up with something of similar length once I 1) implemented equivalent methods, 2) dispensed with all idioms for how to write Ruby and went for single character variable names and method names etc.

In other words, there's nothing particularly "magic" there.

K code gets to where it is largely by because its author and users are willing to violate every convention from other languages in terms of how to write and structure code in pursuit of a philosophy that is fundamentally different in terms of e.g. focusing more on code size.

That could be a good thing, but I'm not convinced that the extremely sparse code is worth the (to me at least) extreme lack in readability.

Code golf can be fun in any language, but it seems few of us have gone back to writing other code and decided it's worth aiming for code that small. In fact, I've more than once rewritten code to be longer because it made it easier to read.

That said, there are good parts in terms of language constructs etc. that'd be worth learning from. If only it wasn't so incredibly annoying to decipher the code (yes, I'm sure it gets faster when you get used to it).