
A functional spreadsheet in 40 lines of code - gruseom
http://www.nsl.com/k/s/s.k
======
tlrobinson
40 lines of the most unreadable code ever...

~~~
gruseom
Of course, that's everyone's reaction (mine too at first). It looks like a
joke language along the lines of Unlambda. But stop and think for a minute.
Could you write a program this powerful in 40 lines of anything, let alone 40
lines of Unlambda?

Readability is relative. Is Java readable to non-programmers? Would a Java
system of equivalent power be as readable as those 40 lines of K, to someone
who knows both languages? Look into it more deeply and it turns out that what
you're dealing with is not a joke or unreadable at all. Rather, it's an
unfamiliar but highly sophisticated programming subculture that is organized
around the principle of succintness-is-power.

The product this code is based on (kdb) is an incredible piece of software.
When I played with it a couple of years ago, here is what it included:

    
    
      - one of the highest-level languages around, which is also blisteringly fast
      - a relational database that scales to terabytes and is thousands of times faster than Oracle
      - an ANSI SQL interpreter
      - extensions to SQL for fast processing of time series
      - a web server
      

... and god knows what else I'm forgetting. The entire download at the time
was 384 Kb. That's right, kilobytes. How is that even possible?

kdb is the ultimate niche product. Hardly anyone has heard of it, but it makes
millions (a couple of years ago the licenses cost $60K per CPU). Who would pay
that? Wall Street, because it delivers performance that mainstream products
can't touch. Take a look at <http://kx.com/company/customers.php>.

The guy who created it, Arthur Whitney, has been working on successive
versions of this for 20 years. He was a protege of Ken Iverson, the inventor
of APL. He also worked on Lisp implementations in the 80s. So what he's doing
here has deep roots in two of the richest computing traditions.

One more thing. After using kdb for a while I realized that this is not just
an engineering tour-de-force: it's breathtakingly beautiful. What a genuine
pity it's locked away from most hackers in a highly profitable but
impenetrable niche.

------
gruseom
Described and commented at <http://www.nsl.com/papers/spreadsheet.htm>.

