1. 20
  1.  

  2. 5

    I worked at a company which extensively wrote code in k, a language created by Arthur Whitney. He’s mad, but there is a genius in his madness. The openj code still has a strong AW flavor to it. Legend has it that the source files are named ‘a.c, b.c’ because he refused to scroll in his text editor. So he worked with one screen of text and called it ‘a.c,’ when he ran out of room he created ‘b.c’ and so on.

    If it isn’t immediately obvious, j and k programmers often compete in ‘code golf’ to compress a program or subroutine into as few characters as possible. A very senior engineer observed something about k which shines light into this mindset: most k verbs (functions) are within an order of magnitude of each other with respect to execution time. So a shorter program usually is faster.

    1. 2

      Formatted version of the code: http://pastebin.com/Qxg26VpY

      1. 2

        Something of a less obfuscated code here: https://gist.github.com/madebyjeffrey/b30fc9537bb21b9ef81c

        I have tried to ‘modernize’ it a little, but I am quite convinced they are playing fast and loose on types. But then again, it is K&R.

      2. 1

        I remember seeing Roger Hui, the J creator, speak in 1990. I was impressed and a little amazed by the macros in that fragment. I actually asked him how he could debug code like that and his answer was “don’t make mistakes”.

        I’ve thought about this code periodically since then and it always make me think how just about any language gives one the ability to write incredibly powerful code - but usually at the expense of understanding.

        1. 1

          How common was it to use VERB and NOUN? Think I’ve heard of that style only in the context of Apollo D-SKY where iirc it was implemented to make the astronauts' lives easier as they weren’t hackers.

          1. 1

            That nomenclature comes from APL.