5 ms·
From experience, my take is that most laymen devs are unwilling and/or uninterested in taking the dive into apl/k/array langs due to the, in their own words, de
by jd3 3y ago
From experience, my take is that most laymen devs are unwilling and/or uninterested in taking the dive into apl/k/array langs due to the, in their own words, deliberately abstruse and obscurantist syntax/glyphs/typing; it's just too theoretical and/or cognitively/neurologically daunting for average engineers that just want to get paid.
- 7thaccount 3y agoI think it's a combination of that and being taught for so long the "right way" to do things with languages like APL appearing "too clever".
- jd3 3y agoAfaik most undergrad education is still explicitly procedural/imperative/OOO with a dash of lisp/scheme in theory of comp. Barring the exceptionally driven and programs that are unusually theoretical and/or historically based (i.e., SICP), many new grads enter industry having only ever used js/python/java/c++ it seems.
- uticus 3y ago> abstruse and obscurantist syntax/glyphs/typing I've often wondered what are the real blocks to having it both ways? Have the source saved as some lowest common denominator - IL, tagged AST, or somesuch - and then read and written in whatever pleases the individual. It would be hard to make it work between languages with drastically different semantics that don't map to anything in another language, I suppose would be the real reason... but I always think about the fact that it makes it down to machine code eventually, so it seems intuitive that the process could be reversed. Or less drastically, an IDE for APL beginners: symbols have human language helpers or UI overlays, but the source is still APL.
- RodgerTheGreat 3y agoThe concise notation of vector languages is not just an affectation; it's a crucial property. Obscuring the notation with long names and "more familiar" syntax diminishes its value. Translating it into something "easier" leaves beginners unable to communicate clearly with APL experts or engage with resources from the broader community. Imagine suggesting to a Prolog programmer that they make the language more accessible to beginners with tools that dynamically translate it into the equivalent Fortran, which is, after all, a Turing-complete language...
- plagiarist 3y agoI'd need some stronger evidence to believe the claim that in-place translation of individual glyphs into words is equivalent to translating between languages with wildly different paradigms.
- gitonthescene 3y agoI'd need some stronger evidence to believe the claim that in-place translation of individual glyphs into words is equivalent to translating between languages with wildly different paradigms.
- vidarh 3y agoIndeed, here's the reference manual for kx systems k 2.0[1] One thing you'll notice is that most of the operations are given names, because trying to communicate about @[d; i; f ;y] doesn't really work, while "Amend Item" does. I'd equally need some very compelling evidence that @[d; i; f; y] is inherently superior to d.amend_item(i,f,y) - or more likely if we were to translate this into a syntax more acceptable to others it'd be more likely to be something like d[i] = f y (but I haven't bothered to figure out exactly the semantics of amend item; I just picked an item from the manual) - to anyone but diehard APL/J/K fans. Most of it can be decomposed and expanded fairly straightforwardly. E.g. after lengthy back and forth a few days back it turns out ",/+|(8#2)\textb" that someone offered up translates into a more familiar OO-syntax roughly to: textb.encode(8.reshape(2)).reverse.transpose.concat ... where the two most unfamiliar parts to most of us would be 1) a standard library where operations that we usually expect to be on an array are usually on each item. So e.g. "reverse" is here not "reverse the array", but "reverse each item in the array", same for the rest. The other two which doesn't have "reasonable" definitions is "reshape", which in this case (two int arguments) just creates an array of 8 elements of the value 2, and "encode" which repeatedly takes a modulo from one array, applies it to each element in the other array, passes the quotient forwards and repeats until the "modulo array" has been processed (putting (8#2), which translates to [2,2,2,2,2,2,2] then basically decomposes bytes into their constituent bits, but you can also do e.g. (24 60 60)\somenumberofseconds to "encode" a number of seconds into hours, minutes and seconds, which might give a better idea of how it works) I'd read the "decoded" version over the terse one any day. I think a "midpoint" that introduced some of these operators in a more "regular" language might well be able to remain readable, but too much density and I can't scan code and get a rough idea of what it does anymore, and that to be is a hard no. Because while some aspects of thinking in terms of arrays this way is also very foreign, the syntax is frankly more than half the battle. [1] https://www.nsl.com/k/k2/k295/kreflite.pdf https://www.nsl.com/k/k2/k295/kreflite.pdf EDIT: Here are some of my notes from trying to figure the above out, and some horrific abuse of Ruby to modify some of the core classes to make something similar-ish to the above actually work: https://gist.github.com/vidarh/3cd1e200458758f3d58c88add05816d1 https://gist.github.com/vidarh/3cd1e200458758f3d58c88add0581...
- adregan 3y ago> Or less drastically, an IDE for APL beginners: symbols have human language helpers or UI overlays Dyalog, which maintains a commercial APL, provides a free development environment which does exactly what you want[0]. You can hover over all of the available glyphs for documentation. It’s a really fun development environment in that it does something that I’ve never really experienced in any another: you can modify prior inputs to experiment with new ideas. Playing with APL (it often does feel like play, or even sculpting with clay) is really fun. Be careful, you might get attached! 0: https://www.dyalog.com/ https://www.dyalog.com/
- uticus 3y ago> you can modify prior inputs to experiment with new ideas having trouble understanding what is meant. like, changing things like in excel?
- abrudz 3y agoTry that experience at https://tryapl.org https://tryapl.org Enter 1+2 where the cursor is below the copyright notice. Now click or use arrow keys to navigate up and change the 2 to a 4 and hit Enter again.
- uticus 3y agoi mean that's cool, but from my background i would say since the input is "variable", assign it to a named variable and run the function with the variable assigned to 2, then again with it assigned to 4. that's doable in most any REPL. or even take the function, and map a range of values to the function, to get a range of outputs. again, doable in most REPLs where the language supports some sort of mapping syntax. can you help me understand what makes this unique? i'm not an APL user, so maybe it's just a different mindset altogether that i'm missing.
- 7thaccount 3y agoAPL was one of the first interactive environments along with Lisp. They've had this back when you had a typewriter with a rotating ball with the symbols connected to the time share computer. So you'd type an expression on the typewriter, computer would run it, and it would be printed on actual paper lol. With APL you can also do the stuff you're referring to by creating a function and mapping it to a list of numbers. If you're familiar with REPLs, the experience is similar.
- jodrellblank 3y ago> "I've often wondered what are the real blocks to having it both ways?" That it's not particularly useful. Here's a classic APL: {(~T∊T∘.×T)/T←1↓⍳⍵} And in words: direct function (not T member T jot dot multiply T) compress T gets one drop iota omega. Or in Pythonic words: lambda w: [n for n in range(2, w) if n not in [i * j for i in range(2, w) for j in range(2, w)]] That is, the APL in Englishy words is no clearer. The Python is mostly clear because it's familiar (there are Python programmers who don't know or understand list comprehensions). And isn't it dull to have to type out the "for in range if n in for in range for in range" and a lambda and two list comprehensions? Just to say "numbers which aren't in the multiplication table of those numbers and themselves" Wouldn't it be clear enough if you could write more like a hybrid with JavaScript or C# anonymous functions with curly braces? lambda w: [n for n in range(2, w) if n not in [i * j for i in range(2, w) for j in range(2, w)]] w=>{nums=range(w).Drop(1); nums.where(n=>n not in outer_product(__op__.mul, nums, nums))} w=>{T=range(w).Drop(1); T.where(n=>n not in outer_product(__op__.mul, T, T))} ⍝ no idea why the original APL code used T w=>{T=range(w).Drop(1); T.where(n=>n not in T ∘.× T)} ⍝ outer product as a symbol with normal multiply symbol w=>{T=iota(w).↓(1); T.where(n=>n not in T ∘.× T)} ⍝ drop as a symbol ↓ w=>{T=1↓⍳w; T.where(n=>n not in T ∘.× T)} ⍝ range as a symbol (iota ⍳) w=>{T=1↓⍳w; (T not in T ∘.× T)/T} ⍝ where as a symbol (compress /) w=>{T=1↓⍳w; (~ T ∊ T ∘.× T)/T} ⍝ not ~ and in ∊ as symbols w=>{T←1↓⍳w ⋄ (~ T ∊ T ∘.× T)/T} ⍝ APL statement separator ⋄ {T←1↓⍳⍵ ⋄ (~ T∊T∘.×T)/T} ⍝ implicit lambda argument as a symbol (omega ⍵) {(~T∊T∘.×T)/T←1↓⍳⍵} ⍝ inlined two statements into one, reads right to left Presumably you're fine with symbols in Python like the colon when introducing functions, brackets for lists, asterisk for multiplication, parens and commas for tuples and function arguments, equals for assignment. You're likely fine with ! for Boolean 'not' in C-likes. If you have symbols for range, outer product, filter, in, drop, then you start to realise how annoying it is to type them out. We shorten the things we do often, or make them implicit. And we often do loops and data transforms when programming. It isn't the symbols which are the hard bit, and making them words doesn't make them usefully easier.
- 7thaccount 3y agoThe Dyalog IDE lets you hover over each symbol and get an English name, description, and example of it being used monadically and dyadically iirc. The former is like using the symbol as a prefix to an array input and the latter in between two arrays. It doesn't take too long before a lot of symbols just click. It's easier to learn than you think.
- 082349872349872 3y ago> for average engineers that just want to get paid Εὐκλείδης' (fl 300 BC) hot take: https://mathshistory.st-andrews.ac.uk/Biographies/Euclid/#:~:text=Give%20him%20threepence,what%20he%20learns https://mathshistory.st-andrews.ac.uk/Biographies/Euclid/#:~...
- Exolon 3y agoImagine if someone wanted to play music in an orchestra, but couldn't read music because it was "too confusing", but they'd never even tried to learn. They would be laughed out the door. I'm not sure why so many laymen devs you mention (who, incidentally, tend to have an affinity for learning music and other "esoteric" skills) seem to apply that same logic. Like, why not learn and try the basics before throwing your hands up and saying it's too hard. It isn't... although it is very, very different.
- userbinator 3y agoThere has long been an ideological war against knowledge and learning.
- ithkuil 3y agoThe comparison is not fair though. Modern music notation, despite all its faults, is the Fe facto standard. Many attempts have been made to improve it. Some of those attempts may have been objectively better but the cost to change the standard is too high. You wouldn't be surprised if somebody criticized an alternative music notation as being too confusing or requiring too much effort to learn for little benefit if they already know the mainstream music notation