3 ms·
I've learned a bunch of different languages[1], but J (and its friends APL and K) has been both the one that I don't feel I have the patience to learn AND the o
by Verdex 6y ago
I've learned a bunch of different languages[1], but J (and its friends APL and K) has been both the one that I don't feel I have the patience to learn AND the one that I feel like I might fall in love with if I actually learned it.
The incomprehensible programs just seem to hint that there is some sort of maximal information density where every keystroke provides maximal productivity.
There's also something artistically appealing about starting at a program and making a deliberate one character change that makes all the difference ... although on the other hand, that's kind of scary too.
Here's a video that really illustrates the power of this paradigm: https://www.youtube.com/watch?v=a9xAKttWgP4 https://www.youtube.com/watch?v=a9xAKttWgP4
[1] - I learned (in this approximate order): C, Java, Lua, C#, Ruby, Python, Lisp, Forth, Prolog, Clojure, OCaml, Haskell, Erlang, F#, R, Racket, and Rust. I also took a look at languages like: ATS, Cyclone, C++, Idris, Agda, D, and Perl 6. Of all those languages it really feels like APL/J/K are the strange ones.
- Cactus2018 6y ago> Here's a video that really illustrates the power of this paradigm: https://www.youtube.com/watch?v=a9xAKttWgP4 https://www.youtube.com/watch?v=a9xAKttWgP4 Amazing game of life code!
- Verdex 6y agoThe first time I watched the video my response was that he was literally doing magic or that it was some sort of joke. Over time the video has become more approachable and I have a pretty good idea of what is going on. However, if I was asked to approach game of life in APL myself then I think I would still be pretty lost.
- Cactus2018 6y agoA Sudoku Solver in APL https://www.youtube.com/watch?v=DmT80OseAGs https://www.youtube.com/watch?v=DmT80OseAGs
- dTal 6y agoIt's a kind of sleight of hand. It purports to be showing off the power of APL; what it's really showing off is the cleverness of someone who realized that the rules of Life could be expressed as a series of array operations. APL has a kind of mystique, but all it really is is a bunch of NumPy functions with a quirky DSL (of course, APL came first and heavily inspired NumPy). But we've quietly been doing the APL experiment in the background, by pressuring programmers to avoid pure Python in favor of NumPy functions for speed, and the results are in - you can indeed push the array paradigm very far. But not quite far enough to be general and efficient. The jury is still out on whether the quirky DSL is worth anything. My suspicion is that having names for array operators is very valuable indeed, but dedicated symbols for them much less so, and cryptic ASCII digraphs are barking completely up the wrong tree. But if you really want the weird syntax - well, it's not exactly a difficult language to parse, and Unicode is a thing now. If the notation is worthwhile, there's no real reason why any language couldn't have APL built-in as a DSL, just like regex.
- lmm 6y agoRank polymorphism is genuinely important and useful and a lot of languages are missing it. Cryptic symbols, I agree, less so. If your language doesn't arbitrarily restrict identifiers then you can just define the APL operators as functions and write code that looks like APL - I tried doing this in Scala once, and it worked ok. But it's hard enough to convince people to take the time to learn what "map" or "filter" or "<* " does, never mind anything further in that direction.
- leprechaun1066 6y agoLisp has April, which I thought was pretty cool. https://github.com/phantomics/april https://github.com/phantomics/april
- TurboHaskal 6y agoI struggled a lot too. I think the main issue is the problem domain in which these languages excel at. I like compilers, systems programming, distributed systems... but math? statistics? I'm admittedly terrible at that and find it really uninteresting. It doesn't help that most literature on J tries to teach its language concepts showing you how to solve math problems. I have no need for a fancy calculator. For what it's worth, I like K and Klong and found them very approachable. Basically because you can get away by writing Scheme with m-expressions.
- ashtonkem 6y agoMy general belief is that these languages would be far more useful as embedded languages; occasionally there is a need for the core of some complicated system to take advantage of their power, but the same design that makes them good at math makes them horrible for writing APIs or database access.
- beagle3 6y agoThey work better than databases for accessing databases - nsl.com has examples like tables.k , a reasonably efficient in memory ordered-and-mostly-relational database in all of 14 lines of K. And a variety of spreadsheets, from 2 to 100 lines. They were sort-of-ok for API access, but Shakti’s FFI is actually incredibly straightforward - comparable to writing a C extern definition only much terser (‘cause it’s Arthur...)
- smabie 6y agoWhat makes them bad for APIs or databases? Both k and q are very practical general purpose languages (J and APL less so) that would be an appropriate choice for almost any kind of app, imo. q especially looks mostly like a normal procedural language, and can be used like one too.
- jodrellblank 6y agoAPL isn't always written (⊂∘⍋⌷⊢), APL has a traditional notation which is like other procedural languages: :If databaseResult.Rows.Count > 5 :AndIf warnOnLargeData :For Row :In databaseResult.Rows logToFile 'Careful, that's a lot of data, e.g. ', Row[1] :EndFor :EndIf and Dyalog APL is a .Net language, which has extended this style with :Namespace and :Class and :Access and :Signature ways to build objects and methods to make your API and export it as a .DLL for use by other .Net languages, or plugin to ASP.Net and make a web service[1], or accessing most things C# can[2], e.g. if you want to use a System.Collections.ArrayList it's right there: ⎕USING←'System' 'System.Collections' arr←⎕NEW ArrayList tmp←arr.Add ⊂'Test' tmp←arr.Add ⊂'Hello' tmp←arr.Add ⊂'World' arr[0 1 2] ┌────┬─────┬─────┐ │Test│Hello│World│ └────┴─────┴─────┘ arr.RemoveAt 0 arr[0 1] ┌─────┬─────┐ │Hello│World│ └─────┴─────┘ and that means things like System.Data.DataTable and SQL Connections for your database access. .Net isn't as popular as JavaScript and Rust, but it is a pretty large, stable, capable and established ecosystem to be able to hook into. The core of APL symbols more or less /are/ an embedded language in the wider APL, just that wider APL is not showy for codegolf and is not unusual and pretty symbols, and you can't use it /without/ the symbols. [1] See the examples shipped in the install folder like "C:\Program Files\Dyalog\Dyalog APL-64 18.0 Unicode\Samples\asp.net\webservices\" [2] I expect not /everything/ C# can; C# is the first-class .Net language, but if you have things written in C# you can use them.
- deleted 6y ago[deleted]
- jxy 6y agoHave you learned Chinese, Japanese or Korean? Perhaps try classical Chinese.