5 ms·
APL is very nice. If you find it interesting, there are two descendants: J, which drops the special characters in favor of ASCII, and tries to retain (and impr
by beagle3 13y ago
APL is very nice. If you find it interesting, there are two descendants:
J, which drops the special characters in favor of ASCII, and tries to retain (and improve on) APL's elegance with respect to math.
K drops the special characters and a lot of the data structures, functions, operators and syntax, and tries to be as pragmatic as possible (including speed).
K programs tend to be 30-50% shorter than the equivalent J or APL program, and much faster than APL (although comparable to J).
If you prefer Ada or Pascal to C, or Haskell to OCaml, you'll like APL or J better.
If you prefer C's shorthand to Ada's verbosity, and OCaml's pragmatism to Haskell's purity, you'll like K better.
I like K better.
- bakul 13y agoI too like K better but it is nice to see another APL implementation and a free one at that. Also note that dyalog has made their commercial APL available on the RaspberryPi. The open source "kona" is close to K version3 (no longer available from kx.com as they have moved on to Q, another very powerful array / database language). So far kona is only 7.2K lines of C code though admittedly very dense code (it is sort of like writing K in C!).
- beagle3 13y agoYou are probably aware, but just in case: K (v4) is underlying Q. You can get to it by typing a single backslash followed by enter (or alternatively, prefixing a line with "k)", or loading a script that has the .k extension) K (v5) is shaping up here http://kparc.com/ http://kparc.com/ . Still early, but it looks like if Arthur Whitney ran the STEPS project, it would be closer to 2,000 lines, than to 20,000 ...
- gruseom 13y agoK (v5) is shaping up here http://kparc.com/ http://kparc.com/ Holy cow! I am floored that they are doing that. That is a hugely ambitious departure from the high-end enterprise niche they've always been limited to. How exciting. Please tell me this is all open source?
- doublec 13y agoThere's some discussion on it from /r/apljk a year ago which stated that it was a research project: http://www.reddit.com/r/apljk/comments/xktud http://www.reddit.com/r/apljk/comments/xktud
- asdasf 13y agoYour comparisons to other languages are pretty misguided. In particular, virtually everyone who prefers haskell over ocaml also prefers C over ada or pascal, making it contradictory. Ocaml isn't more pragmatic than haskell.
- beagle3 13y agoIt's an "or", not "and necessarily". People I know that prefer J (or APL) to K, tend to prefer Haskell to OCaml, _and_ / _or_ Ada to C _and_ / _or_ VHDL to Verilog. YMMV. Ocaml is more pragmatic than Haskell, in my opinion: Eagerness is more practical than laziness (if less elegant and less theoretically beautiful), refs more practical than e.g. state monads. I'm not fluent in either, so correct me if I'm wrong, but my impression is that OCaml is in most senses an impure superset of Haskell (there is always a relatively simple, though rarely trivial, translation from Haskell to OCaml, but the other way around does not exist if you use any state). http://jxyzabc.blogspot.com/2009/03/haskell-vs-ocaml-or-ravings-of.html http://jxyzabc.blogspot.com/2009/03/haskell-vs-ocaml-or-ravi... echoes my impression. The discussion is, of course subjective - given a way to do IO and turing completeness, all languages are in many senses equally practical.
- asdasf 13y ago>It's an "or", not "and necessarily". Yeah, but what I am saying is that you put the same people on both sides. Virtually everyone in haskell land is a C fan, it was a recent topic of discussion actually. >Ocaml is more pragmatic than Haskell, in my opinion There's a reason the haskell community is far larger than the ocaml community, and that the tools and libraries for haskell are way ahead of those for ocaml. From a purely pragmatic perspective, haskell is a far more useful language than ocaml. I say this as someone who switched from ocaml to haskell for entirely practical reasons. >Eagerness is more practical than laziness No it isn't. In 95% of cases it isn't relevant. In the other 5%, you want to use the right one. For practical purposes, it does not matter if a language is lazy by default or strict by default, as long as it is easy to do the other one. Ocaml makes it easy to do lazy, haskell makes it easy to do strict. >refs more practical than e.g. state monads Refs are not comparable to state monads. They are comparable to IORefs, or MVars, or TVars. Which are more useful than ocamls refs. A state monad is an extra thing ocaml simply lacks altogether. >so correct me if I'm wrong, but my impression is that OCaml is in most senses an impure superset of Haskell Not at all. Ocaml and haskell share a similar subset, but both have large area the other doesn't. There is very rarely a simple translation from haskell to ocaml, as ocaml is missing so many things that are commonly used in haskell code. There is more often a simple translation from ocaml to haskell, as idiomatic ocaml rarely uses objects. First class modules is generally the issue with translating in that direction. >http://jxyzabc.blogspot.com/2009/03/haskell-vs-ocaml-or-ravi.. http://jxyzabc.blogspot.com/2009/03/haskell-vs-ocaml-or-ravi.... echoes my impression. Yes, and it repeats the same weird memes about haskell that don't actually make any sense to someone who has used haskell for a non-trivial project. Like "needing monads for state".
- mbq 13y agoCertainly more than two, with R being probably the most popular due to a familiar syntax.
- jdale27 13y agoWhat is the relationship between APL and R?
- mbq 13y agoA mixture of array and functional paradigms; writing efficient code in R requires basically the same type of thinking like in APL or J/Q/K and friends. Historically, R is a sort of a Scheme-based implementation of S, an earlier language which was basically a mixture of APL and Fortran that a statistician would use (i.e. not get discouraged by a bizarre syntax or for-pyramids). Syntax is probably an effect of the fact that both C and S were co-evolving in the same institution.
- Lobachevsky 13y agoBoth APL and R promote interactive exploratory programming. Both are strong in computational programming and intended primarily for domain experts, though over the years APL has drifted more into a domain for developers. In my opinion, APL's array capabilities are far stronger and notation less noisy, i.e. less syntax and punctuation. R seems to have been developed with tools like Lex and Yacc and the language has a certain look and feel.
- robomartin 13y ago> J, which drops the special characters in favor of ASCII, > K drops the special characters and a lot of I've covered this at length before [0][1][2][3]. Calling J and K improvements over APL because they do away with APL's symbolic notation (which is a powerful tool for thought) is like saying that transliterating an orchestral score into randomly chosen ASCII characters is an improvement. Let's take the whole note and represent it with an "o", a half note will be ".", eight is ",", sixteenth is "`" and so on. Let's also ASCII-fy all other elements of the notation. Slurs could be a grouping of the above characters between parenthesis, like this "(o,,,,````````..). I could go on. It's ridiculous. Musical notation is a fantastic tool for the expression of, well, music and if you know it well, it is one of the tools you use to think about your music. You can read it, write it, sing and imagine the music in your mind, all from this notation. APL is the same. If you know it. If you don't take the time to master musical notation it is either gibberish to you or it is really thick and dense, almost impenetrable and decidedly useless as a tool for thought. The same is true of a language like APL. J came at a time when doing custom notation was difficult. In the early days you had to use specialized terminals (as in real terminals, not terminal emulation software) and go as far as installing custom ROMs in graphics cards in order to be able to display the custom font. In that context it is easy to imagine someone thinking that ASCII-fying APL was a good idea. And, in the process, rip out the most important tool in APL: the power of notation. I'll have to play with GNU APL. I am glad to see this happen. Not necessarily thrilled that it is written in C++. This could open the door to exponential gains in programmer productivity [4] for writing web applications. As I mentioned in [1] there's a huge list of evolutionary changes that could really take the APL concept to a whole new level. Who knows, maybe this is the start of a comeback of sorts. [0] https://news.ycombinator.com/item?id=6116911 https://news.ycombinator.com/item?id=6116911 [1] https://news.ycombinator.com/item?id=6117346 https://news.ycombinator.com/item?id=6117346 [2] https://news.ycombinator.com/item?id=6119314 https://news.ycombinator.com/item?id=6119314 [3] https://news.ycombinator.com/item?id=6119221 https://news.ycombinator.com/item?id=6119221 [4] An experienced, capable and well-rounded APL programmer can easily do the job of five to ten programmers in C-like languages. The productivity gains are hard to believe until you've experienced both ends of the scale yourself. As an experienced C programmer I could never even hope to produce code fast and accurately enough to keep up with what I could do in APL with just a few lines of code. It's not about coding speed but rather the speed at which ideas can be translated into working solutions.