3 ms·
There is some experience with this in the K community, and the answer is "it does not gain accessibility"; and "extracting reusable definitions" goes against th
by beagle3 9y ago
There is some experience with this in the K community, and the answer is "it does not gain accessibility"; and "extracting reusable definitions" goes against the spirit of APL, at least for the simple stuff.
Everyone focuses on the syntax because that's the first thing you see, but it's just the tip of the iceberg. The real problem is that you have to think differently, and a weird representation actually HELPS you start thinking differently.
My favourite two examples (K syntax - K is of the APL family) are: maximum subarray sum, written in K |/0(0|+)\ and in english "max over 0 (0 max plus) scan"; And flatten, written in K ,// and in english "join over converged".
They are both good examples of K's orthogonality (which is shared by APL and J), and of the fact that the english doesn't make them more readable if you don't already have the right mindset.
K has a verbose english syntax called Q. People who grok the APL mindset, quickly drop Q for K (which is terser and uses symbols), and people who don't rarely find Q more palatable than K.
- dang 9y agoThe version of this in the Lisp family is the many attempts to replace s-expressions or "drop the parens". The original notation always bounces back unscratched because it's a deep fit for the mindset.
- jim-jim-jim 9y agoThat's very true. I'm having fun trying to wedge my brain into an APL-shaped hole right now because I did it with Lisp before and know it eventually pays off.
- RodgerTheGreat 9y agoA few of my favorite longer phrases: expand a run-length encoded list: ,/#/' maximum depth of a nested list: #,/\ shape of a rectangular nested structure: -1_#:'*:\ count of each group: #:'=: which in k5 and newer leads nicely to a way to find the mode of a list. k5 made group produce a dictionary instead of a list of lists, and the grade operators are overloaded to sort dictionary keys by values, producing a list: *>#:'=:
- Avshalom 9y agoI like the permutation example, make a n^n array of 1...n there by ending up with n choose n with replacement, create a boolean mask of which ones have all n numbers and return. There was a post here last week about BEAM needs an apl that pointed out the basic idiom of APL is take an array make a boolean mask then select on that mask which I thought was a very straight forward explaination of how APL differs from Matlab or Numpy. And it is a very different approach: make everything take what you want vs make exactly and nothing more than what you want.