Live data from Hacker News

Uiua: A minimal stack-based, array-based language

uiua.org

21–30 of 107 posts

Re: Uiua: A minimal stack-based, array-based language

#22
post #3

This is really cool — great work. J & APL are elegant but not easy to get started with, and difficult to install. This looks like a newer, nicer, more open version. Would be great to see some Advent of Code puzzles in Uiua..

BQN is also easier to get started. It's the only array language I ever tried because of that. Uiua seems to be inspired by BQN but it's also a stack-based language (BQN isn't).

It seems heavily inspired by BQN, even the style of the web page.

Re: Uiua: A minimal stack-based, array-based language

#23

I'm a big fan of stack-based languages conceptually, but they always seem to fall flat when it comes to basic reading comprehension. APL has the same issue, as does J. Factor did improve on this a little bit by eschewing the symbol fetish but it was still very difficult to rapidly scan the code for functionality. I'm not convinced the approach shown here is a good pairing with the human brain.

I think for most people the learning curve is steeper with tacit languages, mainly as you have to hold the stack/array state in your head. Mathematicians will probably find it familiar, and as-per forth you could annotate with some sort of stack diagram for an aide memoire.

If you're looking for something more understandable, rebol syntax is phenomenal. It's a concatenative prefixRL language like Uiua (forth is postfixLR), which you can use like a stack or array language by passing the stack/array as the far-right operand. http://blog.hostilefork.com/rebol-vs-lisp-macros/

Furthermore it handles types and has (declarative) scoping unlike say forth which is typeless (panmorphic) and global.

The idea with rebol, similar to Joy, is that operations-on-a-stack is analagous to passing-mutable-stack-to-function so you get tacit programming with both approaches. PrefixRL allows more of a lispy feel, especially when combined with blocks.

Re: Uiua: A minimal stack-based, array-based language

#25
This does look quite nice. I always felt that the operator precedence / association rules in other stack languages were by far the most difficult thing to get used to, not the nonstandard symbols. This appears more inviting in that regard.

I do have to question the choice of right-to-left (array language) evaluation order. I've personally always preferred left-to-right (stack language) evaluation. I feel like right-to-left requires you to think to the end of a line before you start typing anything at all, as the first thing you type is the last thing that's evaluated. Left-to-right would also allow re-evaluating and visualizing the stack as you write each operator.

Re: Uiua: A minimal stack-based, array-based language

#26

I'm a big fan of stack-based languages conceptually, but they always seem to fall flat when it comes to basic reading comprehension. APL has the same issue, as does J. Factor did improve on this a little bit by eschewing the symbol fetish but it was still very difficult to rapidly scan the code for functionality. I'm not convinced the approach shown here is a good pairing with the human brain.

If (and I grant, this is a big if ) you are used to them, the symbolic nature of APLs allows to discuss code fragments (and even entire* algorithms) using inline elements instead of as separate interspersed blocks. The difference between scanning algol-style and apl-style code is a little like the difference between scanning history books and maths books: on one hand, one must scan the latter much more slowly (symbol…

APL people often point to the definition of "average" as evidence for its economy of expression: +/÷≢

They make the argument "the word 'average' has more symbols than its definition, so why not just use the definition inline as a tacit function?"

There's some elegant beauty in this that I'm sympathetic to. However, I think it's fundamentally flawed for one big reason, which in my opinion is the core of the unreadability of APL (and other array languages that rely on custom symbology):

Humans think in words, not letters. There is never semantic content in individual letters; a word is not defined by its letters. Sometimes a word's definition can be deduced from its syllables ("un-happi-ness") but the number of prefixes/suffixes is miniscule compared with the number of root words.

We naturally chunk concepts and create referential identifiers to the abstractions. The point of an alphabet is to make the identifiers generally pronounceable and distinguishable.

+/÷≢ is not pronounceable as a single word, even among APL experts ("add reduce divide tally" is not a word). We have a word for this concept in English, "average" (and synonyms "avg" and "mean"), in common usage among programmers and laymen alike. Using +/÷≢ to mean "average" would be like defining a function AddReduceDivideTally(x), which in any reasonable codebase would be an obviously bad function name.

The semantics of array languages, like stack languages, already lend themselves to extraordinary expressivity and terseness, even without a compressed symbology. What is wrong with this?

    sum := add reduce
    average := sum divide tally
I mean that is it, the essence of "average"! Anyone who knows both English and Computer Science can look at that and understand it more or less immediately. Compressing this into an esoteric alphabet does nothing for furthering understanding, it only creates a taller Tower of Babel to separate us from our goal of developing and sharing elegant definitions of computation concepts.

Re: Uiua: A minimal stack-based, array-based language

#28

This does look quite nice. I always felt that the operator precedence / association rules in other stack languages were by far the most difficult thing to get used to, not the nonstandard symbols. This appears more inviting in that regard. I do have to question the choice of right-to-left (array language) evaluation order. I've personally always preferred left-to-right (stack language) evaluation. I feel like right-t…

...Swap your language prefs to say, arabic? ;) More seriously though, I think it depends what your background is. Maths works in prefix notation eg. f(g(x)) but I appreciate that you can hold the stack in your head easier with postfixLR.

Many people who are used to lisp would probably prefer prefix notation. non-stack or array langs have a nice tradeoff that you can look at the code without having to keep a model in your head, notably many forth users annotate their code with stack diagrams to help. Personally I'm quite taken with rebol syntax, passing a stack/array as the rightmost operand. http://blog.hostilefork.com/rebol-vs-lisp-macros/

Re: Uiua: A minimal stack-based, array-based language

#29
post #4

My recent exposure to array programming languages came via a podcast called The Array Cast[1] Not affiliated, just recommending. The regular co-hosts appear to each be experienced with various array languages such as J, APL, etc. They don't get deeply technical, but it's a nice introduction, especially on explaining the appeal. A recent episode had Rob Pike (UTF-8, Go, etc.) on to talk about his array based calculato…

Could you recommend a good starting episode? I know the generals of languages so I don't know if episode 1 is worth the time investment...

Did you mean generals of array languages? I've only listened to the first 3 episodes so far and the Rob Pike episode[1] I mentioned. I have decades of experience in the popular programming languages and Lisp and some functional languages, but I'm new to array languages and I think I am the target audience.

If you're already experienced with array languages I'm not confident to recommend any particular episodes yet. You might find the Rob Pike/Ivy episode entertaining but maybe not informative. Rob is not an array language expert (he says this in the episode) but he made Ivy partly from nostalgia of APL in his early days. His recollection of that era I found good to listen to.

[1] https://www.arraycast.com/episodes/episode60-rob-pike

Post reply on HN