Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Wow! a text editor in 3 lines of code?

It would be nice if a short write up accompanied this?



Probably most of the work is hidden in the underlying "framework" or "language". Here's a text editor in 1 line of html: <textarea></textarea>


APL is an extraordinarily concise programming language, even without taking its environment into account. This is a well known implementation of Conway's Game of Life in APL:

↑1 ⍵∨.∧3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵


Maybe this will help? I wrote the following up a few years ago now:

https://news.ycombinator.com/item?id=8476633


Thanks for that write up. Is there a decent reference or tutorial for ‘k’ online that you would recommend? I would like to learn more about it’s semantics. For example, the views concept and how old versions of a view/var? Are available.


Not to my knowledge. There are a fair number of documents[1] describing the language to be sure, but it is difficult to divorce K from its implementation(s), so k2, k3, k4, k5 (etc) are all different languages. Your best bet is to download some implementations and try it out. k4 is built-in to kx's q which has a free download[3], just enter a line with a backslash on it to get into k.

Views are just a convenient syntax for memoization. Old versions of the value aren't available.

[1]: http://web.archive.org/web/20041022042401/http://www.kx.com/...

[2]: https://web.archive.org/web/20130801233812/http://www.kuro5h...

[3]: https://kx.com/


There's a decent tutorial now at shakti.com:

https://shakti.com/tutorial/


oK is an implementation of K6 in Javascript. No views, but you can play with it in your browser and the documentation is pretty good.

http://johnearnest.github.io/ok/index.html

https://github.com/JohnEarnest/ok/blob/gh-pages/docs/Manual....

https://github.com/JohnEarnest/ok/blob/gh-pages/docs/Program...


The first line loads http://kparc.com/$/view.k, where the first lines are multiple variable definitions per line.

A non obfuscated version is at http://kparc.com/edit.k where some stuff are explained.


Obligatory clip: Game of Life in APL

https://youtu.be/a9xAKttWgP4




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: