12 ms·
k is perfectly readable. That's like, one of the biggest points of the post. The post mocks the mindset featured within your comment. None of the languages you
by kick 7y ago
k is perfectly readable. That's like, one of the biggest points of the post. The post mocks the mindset featured within your comment.
None of the languages you listed are quite as readable as k to someone who knows it.
All of the languages you listed are significantly slower and feature none of the benefits of a concise notation, even with fast.ai's Python style guide made to imitate Arthur Whitney.
http://www.eecg.toronto.edu/~jzhu/csc326/readings/iverson.pdf http://www.eecg.toronto.edu/~jzhu/csc326/readings/iverson.pd...
- saagarjha 7y ago> The post mocks the mindset featured within your comment. Actually, the post pretends you know nothing about functional programming and then presents K as the solution–but, as the grandparent points out, it’s not the only one. The post actually has no comment on this. (I should also note that smugly mocking a mindset by reducing it to a caricature might help explain why people are exasperated by the post’s patronizing tone.)
- oefrha 7y agoThe post sort of comments on that by claiming that K's somewhat cryptic-looking operator-style functions are more legible than named counterparts. > Does giving a K idiom a name make it clearer, or does it obscure what is actually happening? sum: +/ raze: ,/ ordinal: << > The word “ordinal” can mean anything, but the composition << has exactly one meaning. (That one took a while to click, but it was satisfying when it did.) (Didn’t click for me but I also didn’t spend a while on it, whatever.) However, one should note that it's not like other functional languages don't have their share of cryptic operators, intuitiveness up to debate of course. Here's a list for Mathematica: https://mathematica.stackexchange.com/a/25616 https://mathematica.stackexchange.com/a/25616 At the end of the day this approach doesn't scale very well and skews nicer when you look at very simple examples like +/!100. Anyway, I'll take my sum(range(100)).
- satokema 7y agoeverything any of us work with is a cryptic operator, if you think about it...
- lmm 7y ago> k is perfectly readable. That's like, one of the biggest points of the post. The post mocks the mindset featured within your comment. It mocks it, but it doesn't present a convincing argument. Switching from an imperative language to K is making several changes at once, so we can't really conclude anything about the details of which changes are good or bad. The closest I've seen to a controlled experiment is something like: on a Haskell codebase, switch between using symbolic names like "^>>" and alphabetic names like "promap". And my experience has been, in a real-world mixed-ability team, that overall the alphabetic names had the advantage; if this isn't so for K, then we should try to understand the reasons why. The OP gestures at this, but unconvincingly: why yes, "ordinal" is much clearer than "<<", thank you very much. "Ordinal" may mean different things in different contexts, but so too does "<<" for anyone who knows other programming languages; a name that can help with intuition is a good thing even when it isn't perfect. I'm very much a believer in concise notation (more than most people I've worked with), but the advantages of having a name that can be unambiguously spoken are large enough to outweigh a small constant factor. I sketched a mainstream-FP implementation of the famous 1-liner APL game of life, which became something like three lines (not counting implementing the equivalents of the APL operators, which require slightly fancy polymorphism to do the right thing on vectors and matrices but are otherwise not that special) that could actually be read and talked about. That seemed like a good tradeoff. One can - and should - write code that's much denser than the current maintstream style. I do think the industry massively underestimates the value that comes from fitting a function or class on a single page. But I remain unconvinced that it's worth going all the way to code that can't be communicated verbally.
- kick 7y agoI'm very much a believer in concise notation (more than most people I've worked with), but the advantages of having a name that can be unambiguously spoken are large enough to outweigh a small constant factor. I don't believe this holds up to scrutiny. APL as a language was made to be spoken, and it seems to have succeeded in that. Alan Perlis briefly touched on that in a great paper,[1] and just about everyone who's worked with the language and its derivatives agrees that your statement isn't true. The idea that APL and its derivatives can't be "read and talked about" is frankly ignoring reality by any stretch of the imagination. For example, here's [2] [3] [4] some videos disproving your statement, the first two being APL, the last being k itself. For extra bonus points, see Aaron Hsu's talks [5]; pick any of them, they're all pretty good, and most have a segment in them explaining how that viewpoint is wrong. [1] https://www.jsoftware.com/papers/perlis77.htm https://www.jsoftware.com/papers/perlis77.htm [2] https://www.youtube.com/watch?v=a9xAKttWgP4 https://www.youtube.com/watch?v=a9xAKttWgP4 [3] https://www.youtube.com/watch?v=DmT80OseAGs https://www.youtube.com/watch?v=DmT80OseAGs [4] https://www.youtube.com/watch?v=kTrOg19gzP4 https://www.youtube.com/watch?v=kTrOg19gzP4 [5] https://www.youtube.com/results?search_query=aaron+hsu https://www.youtube.com/results?search_query=aaron+hsu
- Cyph0n 7y ago> k is perfectly readable [...] to someone who knows it A great example of a tautology. Every language in existence passes this test... The real test is a language that is readable by those who don’t know it.
- kick 7y agoIf you don't know the language, you won't be writing, editing or improving code in it anyway. Your test is therefore irrelevant for programming languages.
- Cyph0n 7y agoPerhaps, but passing this test implies a lower learning curve, which is extremely relevant for programming languages.
- kick 7y agoIt really doesn't. k's ancestors were taught to high school students and admin in incredibly short spans of time. Here's an anecdote from Kenneth Iverson about a man who learned APL in two weeks, completely alone, and the results after he taught his students it: My daughter Janet attended Swarthmore High School, and recommended Rudy Amann (head of the math department) as an excellent teacher. I therefore approached him with a proposal that we put an APL terminal in his school as a tool for teaching mathematics, suggesting that he first spend the summer with the APL group to assess the matter. Rudy responded that he could spend only two weeks, which he did. I gave him an office with a terminal (and the Calculus text in APL that I had written after our earlier experiment with high school teachers), and invited him to come to me or anyone in the group with questions. Since he never stirred from his office, I despaired, but at the end of the two weeks he announced that he wished to go ahead with the project. Rudy was pleased with the results, and told me of canvassing those of his students who went on to college, finding that they were pleased with the preparation he had given them. One thing he had done was to use some of the final two “review” weeks to show them the translation from things like +/ to the sigma notation they would encounter in college. Here's another where they taught it to high school teachers, with a direct explanation as to how students responded: I believed that APL could be used in teaching, and Adin said that to test the point we must take a text used in the State school system, and try to teach the material in it. He further proposed that we invite active high school teachers. We hired six for the summer, with the plan that two (nuns from a local school, who could provide a classroom in which we supplied a computer [typewriter] terminal) would do the teaching, while the other four (with a two-week head start) would write material. To our surprise, the two teachers worked at the blackboard in their accustomed manner, except that they used a mixture of APL and conventional notation. Only when they and the class had worked out a program for some matter in the text would they call on some (eager) volunteer to use the terminal. The printed result was then examined; if it did not give the expected result, they returned to the blackboard to refine it. There were also surprises in the writing. Although the great utility of matrices was recognized (as in a 3-by-2 to represent a triangle), there was a great reluctance to use them because the concept was considered to be too difficult. Linda Alvord said to introduce the matrix as an outer product — an idea that the rest of us thought outrageous, until Linda pointed out that the kids already knew the idea from familiar addition and multiplication tables. Finally, it was this interest in teaching that led us to recruit Paul Berry, after seeing his Pretending to Have (or to Be) a Computer as a Strategy in Teaching when it appeared in Harvard Educational Review, 34 (1964), pp. 383-401. (From KEI's delightful but sadly unfinished autobiography: https://www.jsoftware.com/papers/autobio.htm https://www.jsoftware.com/papers/autobio.htm)