Saying Goodbye to one line of APL(homewithinnowhere.com) |
Saying Goodbye to one line of APL(homewithinnowhere.com) |
Now, an idea: HN is always complaining that an ipad (or any other tablet) is a consumption device, as it is not designed to be used with keyboard/mouse. Do any of you know if there is an app where you can write APL with a stylus, and has the ability to evaluate expression on the fly, similar to a repl? That would be an awesome thing to do.
[0] https://news.ycombinator.com/threads?id=JaumeGreen#46718221
List of links:
[NKoP]: https://mlajtos.mu/posts/new-kind-of-paper [MathNotes]: https://mlajtos.mu/posts/new-kind-of-paper-5 [Fluent]: https://news.ycombinator.com/item?id=46649223 [Demo]: https://youtu.be/y5Tpp_y2TBk
There’s an iOS port of J but it’s no longer available on the App Store.
While a native APL would be nice, the cloud solution would be robust access to a professional product. Build the chain via existing tools to bridge the iPad to APL running on a desktop machine.
I looked into this recently; but I've decided on Lean 4 as the successor "best language in existence" for my needs.
My recent language comparison: https://github.com/Syzygies/Compare
My APL one-liner story: https://news.ycombinator.com/item?id=27460887
I wonder what makes it so fast? Is it similar to how GHC can fuse/inline ops and such?
It can also avoid creating intermediate results for quite a few operations, because for example reverse, transpose, etc only change how the arrays are traversed (order in which elements are accessed). You can reuse the original data and change the indexing information. That’s known as beating and dragging.
In particular, it has diagrams of the data structures and how the algorithm operates on them.
Issued On Saturday, May 2, 2026 at 2:44:13 AM
Expires On Friday, July 31, 2026 at 2:44:12 AM
Certificate d87df94f5e922e0637aaff31768405813764ca7dadcafbd051bf48898860fb8f
Public Key a9bd7eee0bb4f1e12431ca8fab0a70591b8966dad8226db84f53791e2d81c9e3https://www.ssllabs.com/ssltest/analyze.html?d=homewithinnow...
Once you see +/, you understand ,/ or fn/ - whereas you have to remember that it’s written sum, concatenate, or np.ufunc.accumulate in numpy. The same goes for +\ vs cumsum etc (and you don’t get all of these pre defined).
The difference here means that whilst numpy gets the core array operations down, it’s much less convenient and less self explanatory than the apl system.
((«¬∘∧⊢)' '=⊢)⊸/
This works by building a boolean mask of spaces, and converting it to a mask of 'is a space, preceded by a space', negates that, and replicates out by that inverted mask (i.e. is not a space preceded by a space):Here's stepping through it with some input.
(' '=⊢) "this is a sentence with many spaces"
⟨ 0 0 0 0 1 1 0 0 1 0 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 1 1 1 0 0 0 0 0 0 ⟩
(«' '=⊢) "this is a sentence with many spaces"
⟨ 0 0 0 1 1 0 0 1 0 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 ⟩
((«∧⊢)' '=⊢) "this is a sentence with many spaces"
⟨ 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 1 1 0 0 0 0 0 0 0 ⟩
((«¬∘∧⊢)' '=⊢) "this is a sentence with many spaces"
⟨ 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 0 0 1 1 1 1 1 1 1 ⟩
((«¬∘∧⊢)' '=⊢)⊸/ "this is a sentence with many spaces"
"this is a sentence with many spaces" (¬∘∧⟜«' '=⊢)⊸/
(¬·«⊸∧' '=⊢)⊸/
{¬«⊸∧' '=x}⊸/ # should have double-struck x here (U+1D569), but hn removes itIt's also worth thinking through how all 16 boolean operators work on boolean masks. E.g. what do msk≠msk2, msk<msk2, msk≤msk2 etc. mean? In my experience, the important part is to find crisp domain-specific meanings for these patterns. In general, really, that's how you gain APL fluency. In the same way that reading fluency requires chunking so that letters "disappear", APL fluency requires familiarity with semantic phrases, so you stop thinking in the individual symbols.
[0]:https://blog.wilsonb.com/posts/2023-07-24-suggestivity-and-i...
s:"this is a sentence with many spaces"
s@&~0&':s=" " (1 ∾˜ " "⊸(¬∘⍷))⊸/
which removes the first space of each occurrence of double spacing- ⍪⍤2 add padding on top of surface of bit mask of water
- 2>⌿⍤2 identify where surface is exposed by seeing if air comes after water vertically
- ⍉l⊤⍸∊ collapse and get where water is in chunk position format row-by-row