Alligator Eats The Bigger Number vs. <= Arrows =>

I was thinking about how unfortunate it is that the pairing for XXX-or-equal operators is <= and >=. It goes with the saying out loud of "less than or equal to" and "greater than or equal to". But symbolically it takes something that looks like a left arrow out of the picture. It would be better to use =< and >=, reserving the <= and => for something else.

But sadly, that is not the way history has written things. Regardless of what people do in their own dialects, <= is not going to be some data-flow-direction-arrow in DO...it's going to be less than or equal to. It would be a lot of muscle-memory to retrain to switch, and a lot of frustrating bugs when I messed up and got some strange left-arrow-operator.

This makes me wonder if it makes sense to just go ahead and make =< a synonym for <=, and => a synonym for >=...and accept they've been taken away from other meanings. I have a hard time believing in => as an operator doing something clever when <= is just less-than-or-equal-to, so giving it up is okay. We can just make do with -> or ->> or *-> or >>=, etc. in DO.

I'm always putting on my newbie glasses, trying to have fresh eyes, and not see things with bias. While it's hard to do, it is somewhat possible.

I am really starting to have a problem with <= being "less than or equal to".

It looks like an arrow. It just does. And >= with =< are a much more balanced pair that do not look like arrows.

It's one of those "once it's been seen, you can't unsee it" things. Things just start looking better.

if x >= 10 [print "foo"]
if x <= 10 [print "bar"]

if x >= 10 [print "foo"]
if x =< 10 [print "bar"]

It's a better symmetry. And the <= sticks out like a sore thumb, making it look like information is flowing in some direction... like you're putting 10 into x.

Given how much time I spend programming C, I would probably screw up constantly if <= were given to some other operator, and depending on what it was given to that might cause easy or hard bugs to find. But it seems to me that maybe, what could be done here is that <= and => could be left undefined in the core...and then it would be the users who felt they'd retrained themselves (or had no prior biases they'd be needing to untrain) who could start using them as arrows for whatever purpose they imagined.

This would give people coming to the language without prior biases an advantage, and users who wished could still define <= as less-than-or-equal if they really insisted. They can define => as greater-than-or-equal too, but if they feel hesitant to do so then they may realize why the other definition is poor too.

What do people think? The softer option is to go with what I suggested previously...define both pairs and then let users override the arrows if they feel like it. But the thing about that is that it means people will likely fall into the status quo without having any moment of questioning it, and wind up stuck, whereas an early confrontation with <= being undefined would let them make an informed decision.

At first, I was in agreement. I had never noticed the arrow until you pointed it out, and now I can't unsee it !!
I agree it is a nicer symmetry too... but I am on the fence about it. When you read the code in the current syntax, it says:

>= "greater than or equal to"
<= "less than or equal to"

When you read the proposed syntax, it says:

>= "greater than or equal to"
=< "equal to or less than"

That seems a bit, uhm, awkward. But I dunno, I'm not completely opposed to it. It just grates at me a tiny little bit... but maybe it's just years of doing it the other way.

If both are defined, then no one is going to go through the trouble of changing their ways to use =<. I just don't see that happening. Plus it is going to make code confusing when some people do it one way, and others do it another way. At least if they have to define it to work a different way then that is documented in their code.

My opinion is we either keep the status quo, or throw them into the fire... sometimes it's the only way to appreciate something new :smiling_imp:

1 Like

Maybe you just need to go back a bit further in your memory archive. You might remember something along the lines of "the alligator always wants to eat the bigger number". =< puts the mouth in the right place. With <= it would be eating the equals sign...too full to eat the number. :slight_smile:

Right. So I like it being the burden of the people who insist on it. Those people will have a whole lot of other old definitions they want loaded--there's no way this would be their only complaint.

It may be that scripts that have a Rebol [ ] header will be treated like scripts with a Red [ ] header, and not use any new conventions... grafted as much possible to the old ways. So these kinds of thoughts would be saved for a new language header. Or maybe it would still be Rebol, but Rebol [mode: Quality] :slight_smile: Those are political questions, as to me I'm interested in that Quality with a capital Q...and that means thinking all these things through.

Haha, I laughed out loud at both your responses. :slight_smile: I don't have much else to say, other than ...

I never learned the alligator method. It was something along the lines of "someone is pointing at the smaller number (and laughing at them)" and so in this analogy the <= is the more accurate representation and >= is the one that needs to change. But looking back now, that is a messed up way to think about it, and this programming discussion now has me questioning my childhood :rofl:

Anyway, I digress, I think you sold me on the alligator. It is too full. We need to help the alligator eat properly!

1 Like

<= ... "less than or equal to" the phrase for this symbol is hard wired into my brain. Can't remember when I learnt, probably with playing around on a Commodore Pet and CBM 8032 that I convinced the computer store guy to allow me to play with as a kid. Don't think I've seen different in any language I've used (though it's not a long list).

Math's degree more like ≤ but I still see the < first.

=< "Equal to or less than" - It's possible to learn it, but the ordering is inconsistent with the continuum you'd have in your mind that you're testing against.

=< Looks like a pouty face.. Once you've seen it you can't unsee it :wink:

Ok, so I admit maybe I'm biased. But having <= undefined it likely to be an unnecessary turn-off / hurdle for many people.

1 Like

I never learned about the alligator and I do agree with @Brett about "less than or equal" being imprinted, but I don't think I'd have a problem recognizing what =< stood for. The way we were taught to remember the orientation on the greater-than/less-than 'arrows' was by associating the bigger (open) part of the arrow with the bigger thing and the smaller (point) with the lesser one. This orientation doesn't change with =<.

1 Like