{d:~1=':s:^x / s‿e←1⊸»⊸(>⋈<)' '=𝕩
c:^"aeiou"?_x@&d&~s / c←¬(s/𝕩)∊"aeiou"
x,:,/$`pig`dog c / ins←⥊c⊏["pig","dog"]
x@<(+\d),{3}#c+2*!#c} / ((+`s+e)∾3/c+2×↕≠c) ⍋⊸⊏ 𝕩∾ins
This program implements a Pigdog Latin translator, bien sûr.And with regards to hotkeys, let's say you do Ctrl+alt+shift+esc+e to insert a unicode symbol, is that really better than just having a programming language where the common hotkeys are spelled out with a few ASCII characters?
- k has much fewer primitives. it's easier to remember a smaller set of operations.
- k is statically parsable. APL is not. we know the program structure simply by reading the code.
this is completely subjective. because you find APL more intuitive doesn't prove anything. to each their own.
Yeah, I’d love to discuss with colleagues how square-c works together with right double crowbar.
No, thanks.
eg, instead of "echo yo >> file" you would "echo yo ≥ file"
In the Raku Programming Language there are several non-ASCII operators, although each of them has a pure ASCII equivalent. Some examples: ≤ vs <=, ≠ vs !=, ∈ vs (elem), etc.
The full list: https://docs.raku.org/language/unicode_ascii.html
Part of those two days of commenting was that since K is interpreted all of the developers would hand-obfuscate all of the code so that the variables were a, b, c, etc. so that they would be slightly faster to parse than a multi-character string. This sort of thing is done all the time now, with JS to make it load faster, but his team at least didn't have any scripts to automatically turn developer-friendly code into interpreter-friendly code, they worked with the interpreter-friendly code version.
mine was matlab. thinking of everything as an array, especially things that aren't arrays, was the first pattern I ever learned. I've never used APL in anger but for the most part it comes very easily to me. Maybe not the code golfing and/or idiomatic APL style that people like to post but, like, using the primitives to create increasingly elaborate arrays before discarding anything I don't want, that part has always felt very straight forward.
"""
[...] As a result, K expressions can be opaque and difficult to parse for humans. For example, in the following contrived expression the exclamation point ! refers to three distinct functions:
2!!7!4
Reading from right to left the first ! is modulo division that is performed on 7 and 4 resulting in 3. The next ! is enumeration and lists the integers less than 3, resulting in the list 0 1 2. The final ! is rotation where the list on the right is rotated two times to the left producing the final result of 2 0 1."""
I think the right intuition for APL-family languages is that they mostly do numpy-like operations except their set of operations tend to compose very nicely. So the idea is that one can quickly and interactively figure out a composition of the operations which will do the calculation you want, but you don’t have a complicated compiler and spend most of your time in the operators rather than the interpreted language, and the operators tend to make the cpu happy – they work on contiguous memory, tend to be vectorized, don’t branch unpredictably, etc – so even if you have to compose many steps, you win on the time to write and the time to execute can be hard to beat because the constant factors of each individual operation are good.
For obvious reasons, things like numpy, pandas, dplyr, etc are more popular as their syntax is a bit more readable and it is easier to get data in/out. I think they do lose a bit by not having lots of the useful compostable APL-style operators because those things don’t have comprehensible names.
I love it... It's the exact opposite of every other language design. Others: lets ship it with every tool a developer might ask for. K9: Occam's razor to everything. Nothing is safe.
It is much easier to become good at k/q if you have experts sitting next to you. Learning this at home (or reading about it on hn) can be very frustrating!
Group tells you the places each element occurs in a list. It generates lists of indices.
https://en.wikipedia.org/wiki/Gather/scatter_(vector_address...
The question is... which array language should I pick? What are the reasons to pick one over the other?
I don't really like J but the only serious APL left is the proprietary (though free, and fun) Dyalog; K, the official product, is also proprietary and because Arthur rewrites it every couple of years all the open source clones are of different versions so there isn't much of an ecosystem.
i would also recommend BQN. it has an active community and it's designer Marshall Lochbaum explicitly tried to address some of the warts in APL and j. he's done a great job.
learning any of the array languages will be a tremendous learning experience if you haven't approached the paradigm before
Not that I have any firsthand experience with the matter, but I think Morgan Stanley has been switching over from K to some Haskell-like dialect as well.
APL programmers want to say their language is mathematical notation, well, make it mathematical notation.
https://ngn.codeberg.page/k/#eJxdjssKwjAQRffzFddVFyLFoiiFQD8...
kona : https://github.com/kevinlawler/kona
alto a javascript implementation even with a graphics library : https://github.com/JohnEarnest/ok
edit : assuming you were talking about k and not freq
My maths notebook from high school looked like that. I'm having flashbacks. (At least in text files you can't cram 4 lines of text into 1.)