I remember using Amiga E, from a cover disk of CU Amiga.
Do I remember correctly that Amiga E had a "but" operator, which executes one statement but returns the value of the other? Never understood its point.
I thought it was one of those things that put Amiga ahead of competitors (because other systems had C/D). Oh my teenager brain.
That's some real esolang brain damage. Did somebody see the (four!) needlessly confusing increment and decrement operators in C and think this hadn't gone far enough?
It's not quite COME FROM but it sure is close for a supposedly useful language.
That's just "I wish this was an expression language". Yeah, good idea, why isn't it?
type Num = i32; // Or whatever your preferred numeric type is
fn lower_delta(a1: Num, a2: Num, b1: Num, b2: Num) -> Num {
let da = a2 - a1;
let db = b2 - b1;
if da < db { da } else { db }
}
REPEAT
...
UNTIL CtrlC() OR (IF m:=GetMsg(wnd.userport) THEN ReplyMsg(m) BUT 1 ELSE 0)
Which means loop until Ctrl-C is pressed, or an IDCMP message comes to the window (which must be replied to allow the sender to reuse/free the message, but otherwise we don't care what's in the message, because we know it's either a keypress or a mouseclick, and both end the loop).
The comma operator, or "BUT", lets us capture the result of GetMsg(), go down a positive "we got a message so end the loop" path, but also fits in a ReplyMsg() so we don't have to deal with it anywhere else
I remember using Amiga E, from a cover disk of CU Amiga.
Do I remember correctly that Amiga E had a "but" operator, which executes one statement but returns the value of the other? Never understood its point.
I thought it was one of those things that put Amiga ahead of competitors (because other systems had C/D). Oh my teenager brain.
Edit: looks like I remember correctly!: https://cshandley.co.uk/JasonHulance/beginner_93.html
That's some real esolang brain damage. Did somebody see the (four!) needlessly confusing increment and decrement operators in C and think this hadn't gone far enough?
It's not quite COME FROM but it sure is close for a supposedly useful language.
It's only doing what the https://en.wikipedia.org/wiki/Comma_operator does in C
Why you'd use it? Probably for reducing statements to expressions, e.g.
That's just "I wish this was an expression language". Yeah, good idea, why isn't it?
A more useful example I found:
Which means loop until Ctrl-C is pressed, or an IDCMP message comes to the window (which must be replied to allow the sender to reuse/free the message, but otherwise we don't care what's in the message, because we know it's either a keypress or a mouseclick, and both end the loop).The comma operator, or "BUT", lets us capture the result of GetMsg(), go down a positive "we got a message so end the loop" path, but also fits in a ReplyMsg() so we don't have to deal with it anywhere else
Like I said though, you wanted an expression language, just have an expression language