15

I'm trying to learn APL (Kona), and I'm looking for example projects so I can get an understanding of how an experienced APL'er would organize his/her code.

Any open source projects would be helpful but, non-financial or anything lacking heavy math would be awesome.

jdeseno
  • 7,753
  • 1
  • 36
  • 34
  • 3
    I thought APL existed specifically _for_ heavy math -- one-liner [sieve of Eratosthenes](http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes): `(~R∊R∘.×R)/R←1↓⍳R` – sarnold Jun 05 '11 at 00:52
  • 2
    This shouldn't get closed. The question may be phrased in a borderline way but, the answer is great for a language that is hard to find good resources on. – jdeseno Sep 28 '12 at 13:39

2 Answers2

14

I've been looking too, and haven't found any yet. APL is a very old language; it completely predates the whole open-source movement. Unlike equally-old Lisp (whose history includes much AI lab research and a spirit of open collaboration), APL's culture has been historically associated with IBM, commercial timesharing systems, and finance. Kevin and I are trying to change this with Kona, though.

There is a fair bit of k code at no stinking loops. Some of it was written for a different version of k than what Kona targets, though. Hakan Kjellerstrand also has an excellent K page.

There are also several great APL/J/K/Q books. I particularly recommend Kenneth Iverson's A Programming Language, Henry Rich's J for C Programmers, Jeffry Borror's Q for Mortals (Q is the newest version of Kx's K), and Gilman & Rose's APL: An Interactive Approach. All but the last are readily available online.

Keep in mind is that many people are using APLs as mathematical tools (like R, mathematica, gnuplot, etc.) rather than for programming, per se. (IMHO, J is best for that.) K is designed to be a more general-purpose programming language, and feels like a synthesis of APL, Lisp, and C. It is an outlier in the language family, though.

silentbicycle
  • 1,164
  • 6
  • 9
  • Thanks for the nice words, Scott. Thanks for the nice words, Scott. Another excellent reference to (modern) APL is Dyalog's "Mastering Dyalog APL". A PDF version can be downloadable from http://www.dyalog.com/intro/ . It has - of course - a slant towards the Dyalog system, but is quite general. – hakank Jun 11 '11 at 09:42
  • 7
    Somehow I forgot to mention my APL page: http://hakank.org/apl/ . It has some more references, for example to some video collections about APL. – hakank Jun 11 '11 at 16:30
  • There is an old style guide on Apter's site ( http://nsl.com/papers/style.pdf ). All big K projects are locked inside banks. There are no open-source projects written in K as far as I know. Kona is an opportunity to change that. There are lots of things you could do. A memcached replica or a Redis replica would both be fun. See https://github.com/kevinlawler/kona/issues?labels=apps&sort=updated&direction=desc&state=open&page=1 New K projects will have to establish new conventions. – kevinlawler Sep 01 '11 at 07:05
-12

If you read this, you will see that Kona is "an open-source implementation of the K programming language (K3.2)". Unfortunately for you, if you visit the homepage for the creator of the K Programming Language and look under products, you will see that K seems to be unsupported.

Also, looking at the Wikipedia articles for both APL and K, the syntax seems to be quite complex (e.g. x@>#:'x is used to sort a list of strings by their length)! I recommend learning Assembler (through nasm; one of the most popular assemblers), C++, C, and maybe Python rather than APL or K (both seem to be unsupported and unused).

Joshua Vega
  • 598
  • 1
  • 8
  • 22
  • 3
    The syntax is far less complex than it appears, there are just several operators which are all either "op a" or "a op (b)". That's it. x@>#:'x is x[> #:' x] is x[greatest-to-least-indexes length-of each x]. Or, as you said, "sort strings by length". If you want to sort by ascending length, {x@<#:'x}. ({} is a lambda, the arguments x, y, and z are implicit.) – silentbicycle Jun 11 '11 at 04:15
  • 2
    And while K has a very lispy feel, most of the operator mnemonics come from C. a&b is and/min, a|b is or/max, *a is first, etc. – silentbicycle Jun 11 '11 at 04:16
  • 1
    K is not unsupported, it is just not openly advertised on the Kx products website. Kdb+ and Q, both mentioned on said product page, are built on top of K (on top of K4, "version 4" of K, to be more precise). Every Kdb+ customer has full access to K. – earl Jun 30 '11 at 01:21