From ca98dc86beec19c73ab2564ba78c102ecebf8d90 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Wed, 6 Oct 2021 21:08:46 -0400 Subject: Some note on left-to-right --- docs/commentary/ltr.html | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 docs/commentary/ltr.html (limited to 'docs/commentary/ltr.html') diff --git a/docs/commentary/ltr.html b/docs/commentary/ltr.html new file mode 100644 index 00000000..8ec5c892 --- /dev/null +++ b/docs/commentary/ltr.html @@ -0,0 +1,24 @@ + + + + BQN: Left to right ordering? + + +

Left to right ordering?

+

APL's right-to-left evaluation order is something many programmers ask about, and something I've questioned personally as well. In fact the first significant language I designed, called I, used a left to right ordering for all code.

+

I settled fairly quickly on sticking to the left to right ordering in BQN. I'm still of (at least) two minds about this, in that I'm fairly sure I prefer writing code from left to right but I'm also worried this won't fit in with other aspects of an APL-family language. BQN is an entirely different project than I is, and it's informed much more by APL than I. So I didn't so much switch to RtL as start over, and not switch back to LtR. I wrote about that in this message (lots more discussion above).

+

Considerations

+

English text is read left to right. This in itself is not decisive in either direction: many contend that the way to read a function is first to read the function, then its argument. Although I usually read the other way, I do find that order to be useful sometimes.

+ +

Although mathematical functions are usually evaluated right-to-left, infix operations such as basic arithmetic are usually left-to-right. Of note is the fact that infinite series which start at zero and proceed upwards must be thought of as being evaluated in the positive direction, which is universally rendered as rightwards in number lines.

+ +

See page 147 of this report for an interesting argument.

+

As for programming precedent, stack-based languages such as Forth go from left to right. In Java-style object-oriented programming, methods go from left to right. This style of "method chaining" is particularly prevalent in Javascript.

-- cgit v1.2.3