← Back to context

Comment by IshKebab

2 days ago

I still haven't used K/Q/etc. because they look insane, but the more I read about them the more it seems like they are basically the maths equivalent of regexes. Super terse and powerful. Pretty much write-only. Very useful for interactive use, definitely. But if you find yourself hitting "save" on a regex that's a red flag and if most of your program relies on regexes something has gone very wrong.

> Pretty much write-only

I've written and worked on real-world APL applications, and this doesn't fit my experience. APL allows writing some of the most readable code out there, specifically because it makes whole-application architecture imminently more visible.

I like APL because it keeps me from bike-shedding on boilerplate or ceremony and forces me to consistently think about fundamental issues in the problem domain.

That said, APL by beginners (including myself, years ago) can be pretty terrible and effectively write-only. The steep learning curve is very real, and learning to write good APL is synonymous with learning good application architecture and UX.

They are far from regexes. I feel like you're equating something you don't understand to something else you find difficult. It's a language like any other. Infact it's far less verbose and shorter to read. If you've spent enough time with an arraylang you start to recognize "words" or sequences of glyphs as some complex function[1].

You might have a better time trying something like Uiua[2] or BQN.

[1] https://aplcart.info/

[2] https://www.uiua.org/tour

  • > It's a language like any other. Infact it's far less verbose and shorter to read. If you've spent enough time with an arraylang you start to recognize "words" or sequences of glyphs as some complex function[1].

    Like regexes!

  • > to something else you find difficult

    I didn't say I find regexes difficult. I don't.

The bigger problem is that you often end up using more functions, worse algorithms or higher algorithmic complexity, creating your data structure at runtime, since the only datatype you have are arrays.

It's similar to the problem with unix/plan9, lisp or smalltalk. There is it turns out, too much of a good thing.

Such systems are great for learning, but I would make the mistake of building software on them

  • Common Lisp supports many data structures besides lists, and the same is true of many other Lisps as well.

    And Unix is easily the most used family of operating systems on Earth. Every iOS and Mac OS device has a Unix at its core, same with Android, countless computers in data centers running a Linux distribution, probably many other categories of devices as well.

    I would hesitate to say building software on Unix is a mistake.

  • you don't have to represent everything with arrays (k has arrays, dicts, tables, lists)

    that said: finding array representations and transformations is usually a great idea for clarity and performance

    many problem domains can collapse unnecessary abstractions down to the metal, but many languages and ecosystems make it difficult to "see" when that is the case

    array languages have a way of nudging you into fewer abstractions and modeling things in dense arrays where applicable, and you will be surprised how often that is applicable

    implementations can be highly efficient and will often make use of SIMD (and other optimizations)

    in many cases an idiomatic, simple array language program will beat a naive solution written in C

    BQN documentation has a great read on why

    https://mlochbaum.github.io/BQN/implementation/versusc.html

    the gist is writing in an array language helps because the interpreter has an easier time mapping high level array transformation concepts to optimized vectorized kernels than a C or C++ compiler looking at algol-like code