Discussion:
about some potentially interesting unicode operators
(too old to reply)
fir
2024-08-27 23:58:26 UTC
Permalink
everyone knows how iportant are
operator symbols in C

i found it interesting to watch over
a unicode to find soem that could be
eventually interesting in a context of some language extensions

(somewhat offtioopic is there is some doubt if someone will add new one
to old c, but theoretically still interesting - form me much practical
as i work out new syntax and some
extensions over old c, privately)

so i wrote simple review of some of
them i found

mostly i write just to bit a bit clearer whats in teh bag

i start maybe with the less confusing
becouse later soem are confusing as
they are more close looking to some other and that may be confusing

for basic arrows

a←b a→b a↑b a↓b potentially quite usable (though i dont know for what)
(arrows may be for assigment but its not clear) a←←←b

in addition i find yet 3
a↔b a↕b a↨b , nice

superscriot (?) or how it is called
a¹ba¹º²³b , nice but i dont found
all digits nor normal leters - only some, all would be usefull, could be
good as part of user names (²could be handy for square but other would
be wastefull used like that)

i didint found subscripts - though probably i watched only soem part of
unicode - but will need to stay probably with this more central part
probably

a±b a≈b a≠b a≡b a≤b a≥b

okay nice, could be handy

a«ba»b also nice,
a‹ba›b something liek above but single

a“xx”b" some two new upper
quotation signs - the clasical asci
is simple one those are more like left and right
a„ba„b there is also one new down
probably there is also yet one byt i mislooked it it seems

a‘b''a’b‘‘'’'’

same thing with this single quotation
two new ones

a´b 1`1´ a`s´s´dkm΄x´΄s ΄
brother of this little one that shares key with tilda, nice

there are more things liek that but
those are confusing so i skip it

there is yet third one (?) something
like those two but stright -
all are somewhat like singe quitation but very thin

a¯‾_‾_‾b¯1 ¯232a‾b
a ‾b_

upper underscore - thats real nice
mistake it is not in old asci imo

a‗ba‗b____‗

double underscore, also real nice

a·b·····

middle dot - terribly nice and good loking

a∙ba∙∙b

big middle dot very nice

a─b---─-─ ─────────-----

something like longer minus sign
- could be used to draw line

a,,b

something like , but smaller

a¨b¨¨a…ba…b

two up dots and 3 bot dots
(thos bot especially nice)

a⁄b//⁄⁄

something like slash but a bit
bigger and a bit more vertical

a■b a▬b a▲ba►ba▼ba◄b

rectangle queare and 4 triangles
nice

a◊ba○b☼☼a♦ a◘ba◙ba☺ba☻ba☼ba♀ba♂b
a♠ba♣ba♥ba♦ba♪ba♫b

also nice, this circle is good
rhombus or how it is called also good
a░b░░░▓▓▓▓▒▒░░░░
nice for drawing

a˙ba˙ba˚ba˚b

degree sign and something liek upper dot or small degre, im not sure

a˜b~ something liek small upper tilda

a⌂b⌂⌂⌂

home symbol?

a⌐b

nice geometrucal it is goiod loking imo maybe better than arrow (liek could
be used for assigment etc)


a√b
root symbol - could be nice

a=√a*a+b*b

a∞b
infinity?

a∟b
nice geometrical

a∩b
nice


a∫b - calculus, nice

a∆ba∂ba∏ba∑b
some greek ones i skipped most but
probably they should be used aside
normal abc like ∆b=b2-b1 etc

a‰b

dont know what it is but may be ok


a†ba‡b
also dont know but looks ok

a‼b

double ! very good
a¡b this one turn aroud, lookin good

a¦b

very nice

i ommited some but from those
mentioned a lot are very nice

though still i will probably
feel i need some i dont get
(liek i would have other -+
that would have like bigger priority
than mil div so could write some
espresions without ()

but some are real nice those are especially good imo:

¯2ba‗a∙ba∙∙bb·····──a≡ba…ba…ba⌐b
a∟ba∩ba∫ba■ba▬ba○b☼☼a‼b¡ba¦ab
Blue-Maned_Hawk
2024-08-28 14:17:49 UTC
Permalink
I personally hate all operators. That said, i agree with the general idea
that Unicode has a lot of symbols out of ASCII that are underutilized. C
has limitations on what symbols are permitted in identifiers, but in
previous projects of mine, i was able to work within that prison and used
the · character for a sort of psuedonamespacing. (I later abandoned this
practice for other reasons.)
--
Blue-Maned_Hawk│shortens to Hawk│/blu.mɛin.dʰak/│he/him/his/himself/Mr.
blue-maned_hawk.srht.site
Doesn't read mail (yet)!
Keith Thompson
2024-08-28 19:46:55 UTC
Permalink
Post by Blue-Maned_Hawk
I personally hate all operators. That said, i agree with the general idea
that Unicode has a lot of symbols out of ASCII that are underutilized. C
has limitations on what symbols are permitted in identifiers, but in
previous projects of mine, i was able to work within that prison and used
the · character for a sort of psuedonamespacing. (I later abandoned this
practice for other reasons.)
A problem with using non-ASCII Unicode characters as operator
names is that they can be difficult to type -- and the way you type
them is inconsistent across systems.

There's nothing wrong with using identifiers as operator names.
C already does this with "sizeof" et al.
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+***@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */
Keith Thompson
2024-08-28 20:30:23 UTC
Permalink
Post by Keith Thompson
Post by Blue-Maned_Hawk
I personally hate all operators. That said, i agree with the general idea
that Unicode has a lot of symbols out of ASCII that are underutilized. C
has limitations on what symbols are permitted in identifiers, but in
previous projects of mine, i was able to work within that prison and used
the · character for a sort of psuedonamespacing. (I later abandoned this
practice for other reasons.)
A problem with using non-ASCII Unicode characters as operator
names is that they can be difficult to type -- and the way you type
them is inconsistent across systems.
There's nothing wrong with using identifiers as operator names.
C already does this with "sizeof" et al.
I probably should have said "keywords" rather than "identifiers".
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+***@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */
Lawrence D'Oliveiro
2024-08-28 23:15:51 UTC
Permalink
A problem with using non-ASCII Unicode characters as operator names is
that they can be difficult to type -- and the way you type them is
inconsistent across systems.
The best way is the Compose key available on *nix systems. This is the
closest to a mnemonic-based system that reduces the burden on your memory.

<https://wiki.wlug.org.nz/ComposeKey>
There's nothing wrong with using identifiers as operator names.
C already does this with "sizeof" et al.
Except they add to your list of reserved words.
Keith Thompson
2024-08-29 00:04:46 UTC
Permalink
Post by Lawrence D'Oliveiro
A problem with using non-ASCII Unicode characters as operator names is
that they can be difficult to type -- and the way you type them is
inconsistent across systems.
The best way is the Compose key available on *nix systems. This is the
closest to a mnemonic-based system that reduces the burden on your memory.
<https://wiki.wlug.org.nz/ComposeKey>
There is no "Compose" key on the keyboard I'm using to type this.
There is a key labeled "Alt Gr", but it doesn't appear to behave in
any consistent or useful way. (I'm using a Windows laptop; "Alt Gr"
doesn't appear to do anything useful even in Windows PowerShell.)

If there's an easy way to type non-ASCII characters like '·' that
works across different systems, including all the various terminal
emulators used on Windows and Linux (as well as MacOS, but I don't
happen to use it), I'd love to know about it. (I obtained that
'·' character by opening vim, entering the Ctrl-K . M digraph,
and copy-and-pasting into this window -- not something I'd be
willing to do every time I want to type an operator symbol.)

People who use non-English languages typically have keyboards with
accented letters and so forth.
Post by Lawrence D'Oliveiro
There's nothing wrong with using identifiers as operator names.
C already does this with "sizeof" et al.
Except they add to your list of reserved words.
That's not much of a problem if they're designed into the language from
the beginning. (I'm not suggesting adding new keyword operator symbols
to C -- though C has been acquiring new keywords, including alignof
which is an operator and typeof which resembles one.)
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+***@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */
Janis Papanagnou
2024-08-29 02:07:21 UTC
Permalink
Post by Keith Thompson
There is no "Compose" key on the keyboard I'm using to type this.
Neither on mine. (I recall it from a friend's old IBM computer.
I think it was close to the separate number-block.)
Post by Keith Thompson
There is a key labeled "Alt Gr", but it doesn't appear to behave in
any consistent or useful way.
"Alt Gr" is different. It's used on my keyboards to have access
to a third layer of characters (e.g. € sign or various European
languages' characters).

I have two keyboards connected to my Linux computer, one with US
layout and one with DE layout, both having the "Alt GR" key but
only the DE keyboard seems to produce characters with that key.
Post by Keith Thompson
(I'm using a Windows laptop; "Alt Gr"
doesn't appear to do anything useful even in Windows PowerShell.)
If there's an easy way to type non-ASCII characters like '·' that
works across different systems, including all the various terminal
emulators used on Windows and Linux (as well as MacOS, but I don't
happen to use it), I'd love to know about it.
I don't think there can be a portable or consistent way to create
that character. Incidentally (I just tried a few keys) I can get
the '·' by typing "Alt GR" and ',' (on my DE keyboard). But that
was of course coincidence that this character had been chosen to
be displayed with the "Alt Gr" key since there's only a limited
set of keys for additional characters physically available.
Post by Keith Thompson
(I obtained that
'·' character by opening vim, entering the Ctrl-K . M digraph,
and copy-and-pasting into this window -- not something I'd be
willing to do every time I want to type an operator symbol.)
Understandably.
Post by Keith Thompson
People who use non-English languages typically have keyboards with
accented letters and so forth.
Correct.
Post by Keith Thompson
Post by Lawrence D'Oliveiro
Post by Keith Thompson
There's nothing wrong with using identifiers as operator names.
C already does this with "sizeof" et al.
Except they add to your list of reserved words.
That's not much of a problem if they're designed into the language from
the beginning. (I'm not suggesting adding new keyword operator symbols
to C -- though C has been acquiring new keywords, including alignof
which is an operator and typeof which resembles one.)
Yes. - In Algol 68 you have separate name-spaces for identifiers.
User-defined operators are in the same name-space as the language
keywords and standard operators. The separation of name-spaces is
probably the reason why it's not considered that bad to have a lot
of keywords. C and C++ designers were much more concerned.

Janis
Janis Papanagnou
2024-08-29 15:17:22 UTC
Permalink
Post by Janis Papanagnou
Post by Keith Thompson
If there's an easy way to type non-ASCII characters like '·' that
works across different systems, including all the various terminal
emulators used on Windows and Linux (as well as MacOS, but I don't
happen to use it), I'd love to know about it.
I don't think there can be a portable or consistent way to create
that character. Incidentally (I just tried a few keys) I can get
the '·' by typing "Alt GR" and ',' (on my DE keyboard). [...]
Keith, what does your keyboard produce when typing <Alt>-<7> ?

On my US keyboard it produces the '·'. Don't know whether that
is reliable, though. (I don't think it is; e.g. my Thunderbird
doesn't expand any character when entering <Alt> combinations.)

Janis
Keith Thompson
2024-08-29 16:59:49 UTC
Permalink
Post by Janis Papanagnou
Post by Janis Papanagnou
Post by Keith Thompson
If there's an easy way to type non-ASCII characters like '·' that
works across different systems, including all the various terminal
emulators used on Windows and Linux (as well as MacOS, but I don't
happen to use it), I'd love to know about it.
I don't think there can be a portable or consistent way to create
that character. Incidentally (I just tried a few keys) I can get
the '·' by typing "Alt GR" and ',' (on my DE keyboard). [...]
Keith, what does your keyboard produce when typing <Alt>-<7> ?
On my US keyboard it produces the '·'. Don't know whether that
is reliable, though. (I don't think it is; e.g. my Thunderbird
doesn't expand any character when entering <Alt> combinations.)
It produces the two-character sequence Escape 7.
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+***@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */
Michael S
2024-08-29 20:02:46 UTC
Permalink
On Thu, 29 Aug 2024 09:59:49 -0700
Post by Keith Thompson
Post by Janis Papanagnou
Post by Janis Papanagnou
Post by Keith Thompson
If there's an easy way to type non-ASCII characters like '·' that
works across different systems, including all the various terminal
emulators used on Windows and Linux (as well as MacOS, but I don't
happen to use it), I'd love to know about it.
I don't think there can be a portable or consistent way to create
that character. Incidentally (I just tried a few keys) I can get
the '·' by typing "Alt GR" and ',' (on my DE keyboard). [...]
Keith, what does your keyboard produce when typing <Alt>-<7> ?
On my US keyboard it produces the '·'. Don't know whether that
is reliable, though. (I don't think it is; e.g. my Thunderbird
doesn't expand any character when entering <Alt> combinations.)
It produces the two-character sequence Escape 7.
Which 7? The one on numeric pad produces • in quite a lot of contexts.
The character appears after release of Alt key.
Scott Lurndal
2024-08-29 20:18:20 UTC
Permalink
Post by Michael S
On Thu, 29 Aug 2024 09:59:49 -0700
Post by Keith Thompson
On 29.08.2024 04:07, Janis Papanagnou wrote: =20
On 29.08.2024 02:04, Keith Thompson wrote: =20
If there's an easy way to type non-ASCII characters like '=C2=B7' that
works across different systems, including all the various terminal
emulators used on Windows and Linux (as well as MacOS, but I don't
happen to use it), I'd love to know about it. =20
=20
I don't think there can be a portable or consistent way to create
that character. Incidentally (I just tried a few keys) I can get
the '=C2=B7' by typing "Alt GR" and ',' (on my DE keyboard). [...] =20
Keith, what does your keyboard produce when typing <Alt>-<7> ?
On my US keyboard it produces the '=C2=B7'. Don't know whether that
is reliable, though. (I don't think it is; e.g. my Thunderbird
doesn't expand any character when entering <Alt> combinations.) =20
=20
It produces the two-character sequence Escape 7.
=20
Which 7? The one on numeric pad produces =E2=80=A2 in quite a lot of contex=
ts.
The character appears after release of Alt key.
The numeric pad ALT-'7' produces <esc>[H (home cursor).
Michael S
2024-08-29 20:32:52 UTC
Permalink
On Thu, 29 Aug 2024 20:18:20 GMT
Post by Scott Lurndal
Post by Michael S
On Thu, 29 Aug 2024 09:59:49 -0700
Post by Keith Thompson
On 29.08.2024 04:07, Janis Papanagnou wrote: =20
On 29.08.2024 02:04, Keith Thompson wrote: =20
Post by Keith Thompson
If there's an easy way to type non-ASCII characters like
'=C2=B7' that works across different systems, including all
the various terminal emulators used on Windows and Linux (as
well as MacOS, but I don't happen to use it), I'd love to know
about it. =20
=20
I don't think there can be a portable or consistent way to
create that character. Incidentally (I just tried a few keys) I
can get the '=C2=B7' by typing "Alt GR" and ',' (on my DE
keyboard). [...] =20
Keith, what does your keyboard produce when typing <Alt>-<7> ?
On my US keyboard it produces the '=C2=B7'. Don't know whether
that is reliable, though. (I don't think it is; e.g. my
Thunderbird doesn't expand any character when entering <Alt>
combinations.) =20
=20
It produces the two-character sequence Escape 7.
=20
Which 7? The one on numeric pad produces =E2=80=A2 in quite a lot of
contex= ts.
The character appears after release of Alt key.
The numeric pad ALT-'7' produces <esc>[H (home cursor).
It looks like your usenet client displays my post quite differently from
my client. In order to establish a common ground please look at my post
here:
https://www.novabbs.com/devel/article-flat.php?id=39202&group=comp.lang.c#39202
Scott Lurndal
2024-08-29 21:24:16 UTC
Permalink
Post by Michael S
On Thu, 29 Aug 2024 20:18:20 GMT
Post by Scott Lurndal
Post by Michael S
contex= ts.
The character appears after release of Alt key.
The numeric pad ALT-'7' produces <esc>[H (home cursor).
It looks like your usenet client displays my post quite differently from
my client. In order to establish a common ground please look at my post
Perhaps you could avoid unnecessary UTF-8 instead...
Michael S
2024-08-30 10:50:45 UTC
Permalink
On Thu, 29 Aug 2024 21:24:16 GMT
Post by Scott Lurndal
Post by Michael S
On Thu, 29 Aug 2024 20:18:20 GMT
Post by Scott Lurndal
Post by Michael S
contex= ts.
The character appears after release of Alt key.
The numeric pad ALT-'7' produces <esc>[H (home cursor).
It looks like your usenet client displays my post quite differently
from my client. In order to establish a common ground please look at
my post
Perhaps you could avoid unnecessary UTF-8 instead...
Perhaps in this particular theme they are necessary.
Keith Thompson
2024-08-29 20:41:35 UTC
Permalink
Post by Scott Lurndal
Post by Michael S
On Thu, 29 Aug 2024 09:59:49 -0700
[...]
Post by Scott Lurndal
Post by Michael S
Post by Keith Thompson
Post by Janis Papanagnou
Keith, what does your keyboard produce when typing <Alt>-<7> ?
On my US keyboard it produces the '·'. Don't know whether that
is reliable, though. (I don't think it is; e.g. my Thunderbird
doesn't expand any character when entering <Alt> combinations.)
It produces the two-character sequence Escape 7.
Which 7? The one on numeric pad produces • in quite a lot of contexts.
The character appears after release of Alt key.
The numeric pad ALT-'7' produces <esc>[H (home cursor).
(I manually cleaned up some quoted-printable damage in the above.)

The numeric pad keys send different characters depending on whether Num
Lock is set. I usually have it on.

Alt-7 sends the same thing (Escape-7) both for the 7 key above Y and U
and for the 7 key on the numeric pd. With Num Lock off, that key acts
as the Home key; Home sends ^[[1~ and Alt-Home sends ^[[1;3H, where ^[
is Escape.

There are probably some subtleties I'm missing. I rarely use either Alt
or AltGr. I don't often need to type non-ASCII characters; when I do,
my most common approach is to use vim digraphs. Possibly I could find a
method that's more convenient, but so far I haven't been motivated to do
so.
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+***@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */
Lawrence D'Oliveiro
2024-08-30 03:16:39 UTC
Permalink
Post by Keith Thompson
I don't often need to type non-ASCII characters; when I do,
my most common approach is to use vim digraphs.
Does it let you type (part or all of) Unicode names?
Keith Thompson
2024-08-30 04:35:29 UTC
Permalink
Post by Lawrence D'Oliveiro
Post by Keith Thompson
I don't often need to type non-ASCII characters; when I do,
my most common approach is to use vim digraphs.
Does it let you type (part or all of) Unicode names?
I don't think so.
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+***@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */
Lawrence D'Oliveiro
2024-08-31 00:01:00 UTC
Permalink
Post by Keith Thompson
Post by Lawrence D'Oliveiro
Post by Keith Thompson
I don't often need to type non-ASCII characters; when I do,
my most common approach is to use vim digraphs.
Does it let you type (part or all of) Unicode names?
I don't think so.
Emacs does.
Lawrence D'Oliveiro
2024-08-29 05:58:17 UTC
Permalink
Post by Keith Thompson
Post by Lawrence D'Oliveiro
A problem with using non-ASCII Unicode characters as operator names is
that they can be difficult to type -- and the way you type them is
inconsistent across systems.
The best way is the Compose key available on *nix systems. This is the
closest to a mnemonic-based system that reduces the burden on your memory.
<https://wiki.wlug.org.nz/ComposeKey>
There is no "Compose" key on the keyboard I'm using to type this.
Remember, you can assign your own keys on *nix GUIs.

I use Caps Lock for this purpose.
Post by Keith Thompson
People who use non-English languages typically have keyboards with
accented letters and so forth.
As I have mentioned before, the idea that only “non-English languages”
needs such symbols demonstrates a certain ... naïveté.

Lawrence
living near a district named Waipā, down the road from Tāmaki Makaurau
recently bought a product from overseas priced in £
has published software subject to ©
David Brown
2024-08-29 10:51:18 UTC
Permalink
Post by Keith Thompson
Post by Lawrence D'Oliveiro
A problem with using non-ASCII Unicode characters as operator names is
that they can be difficult to type -- and the way you type them is
inconsistent across systems.
The best way is the Compose key available on *nix systems. This is the
closest to a mnemonic-based system that reduces the burden on your memory.
<https://wiki.wlug.org.nz/ComposeKey>
There is no "Compose" key on the keyboard I'm using to type this.
There is a key labeled "Alt Gr", but it doesn't appear to behave in
any consistent or useful way. (I'm using a Windows laptop; "Alt Gr"
doesn't appear to do anything useful even in Windows PowerShell.)
The Alt-Gr key works differently depending on the keyboard layout.
Typically you need to choose some kind of "international" layout to get
a distinction between Alt-Gr and Alt. Then you have easy access to a
fair number of additional characters, even ones that are not required
for the language you use. The disadvantage is that some keys become
"dead" keys, especially for accents and other diacriticals. So if you
pick "international" versions of the US or UK keyboard layouts, rather
than the standard ones, you get some Alt-Gr characters.

However, even with that, Windows keyboard layouts are quite limited
compared to Linux. And you don't have a Compose key on Windows. (If
I'm wrong there, I'd be happy to be corrected!). Most Linux keyboard
layouts don't have a Compose key by standard either, but it's generally
a simple setting to change that (I usually use Scroll Lock as a Compose
key).

Even when you are able to type extra operators or symbols, it's often
hard to read them (assuming in the first place that you are using a font
that supports them - this can also be an issue, especially on Windows).
I can type "x ← y" quite easily (it's shift Alt-Gr i) but I find it a
lot harder to read than "x <- y" would be at the same font size.
Post by Keith Thompson
If there's an easy way to type non-ASCII characters like '·' that
works across different systems, including all the various terminal
emulators used on Windows and Linux (as well as MacOS, but I don't
happen to use it), I'd love to know about it. (I obtained that
'·' character by opening vim, entering the Ctrl-K . M digraph,
and copy-and-pasting into this window -- not something I'd be
willing to do every time I want to type an operator symbol.)
People who use non-English languages typically have keyboards with
accented letters and so forth.
Post by Lawrence D'Oliveiro
There's nothing wrong with using identifiers as operator names.
C already does this with "sizeof" et al.
Except they add to your list of reserved words.
That's not much of a problem if they're designed into the language from
the beginning. (I'm not suggesting adding new keyword operator symbols
to C -- though C has been acquiring new keywords, including alignof
which is an operator and typeof which resembles one.)
Too many reserved words in a language quickly becomes a problem. It can
get in the way of picking sensible identifiers for your own usage, and
because a real issue when you want to add more in the next language
version.

What makes more sense, IMHO, is to design the language in such a way
that you can have user-defined operators (prefix, postfix and infix)
with either alphanumeric or punctuation, and a language syntax and
grammar that can distinguish them from other types of identifiers even
if the names crash. You might still get occasional ambiguous parses,
but that can be a compile-time error.

And if these are all user-definable, then they are also definable in the
language's standard library. Then code can pull in the operators it
needs without any others, and it's easy to have aliases such as unicode
symbols and alphanumeric names.
Lawrence D'Oliveiro
2024-08-28 23:13:58 UTC
Permalink
Post by Blue-Maned_Hawk
I personally hate all operators.
Operators are great. They’re popular in maths because they avoid
parenthesis clutter, leaving the structure of the expression clearer.

Fun fact: Python’s operator precedence rules differ from C’s ones in one
subtle little way, that actually reduces the need for parentheses in real-
world code.

While Python and C++ let you define new overloads for standard operators,
very few languages allow you to define entirely new operators. Algol 68
did (from a limited character set). You can kind of simulate it in Python,
too.
Janis Papanagnou
2024-08-29 01:36:57 UTC
Permalink
Post by Lawrence D'Oliveiro
Fun fact: Python’s operator precedence rules differ from C’s ones in one
subtle little way, that actually reduces the need for parentheses in real-
world code.
It's the bit-operations (&, ^, |), I suppose? <lookup> Yes!
Python did the right thing (here).
Post by Lawrence D'Oliveiro
While Python and C++ let you define new overloads for standard operators,
very few languages allow you to define entirely new operators. Algol 68
did (from a limited character set).
Redefining priorities of operators in Algol 68 (a rarely found
feature) might be surprising to the unaware, though.

Janis
fir
2024-08-29 08:45:48 UTC
Permalink
Post by Lawrence D'Oliveiro
Post by Blue-Maned_Hawk
I personally hate all operators.
Operators are great. They’re popular in maths because they avoid
parenthesis clutter, leaving the structure of the expression clearer.
Fun fact: Python’s operator precedence rules differ from C’s ones in one
subtle little way, that actually reduces the need for parentheses in real-
world code.
While Python and C++ let you define new overloads for standard operators,
very few languages allow you to define entirely new operators. Algol 68
did (from a limited character set). You can kind of simulate it in Python,
too.
its not much about allowing to define operators - but about the fact C
lacks some

soem lack is scandalous : min max abs sign and some other (like clamp
(?) et.., maybe swap) also i think it would be good to have stronger
priority adds and subs

to be able to writa 2+2/4 instead of (2+2)/4
it could be like + - but placed a bit higher (unicode dont have it i guess)

also assign in right could be handy etc...many should be defined
Lawrence D'Oliveiro
2024-08-28 23:11:50 UTC
Permalink
a⌐b
What you have there is U+2310 REVERSED NOT SIGN.

For comparison, “¬” is U+00AC NOT SIGN. It denotes logical negation. It
would be a natural replacement for the “!” prefix monadic operator.

In fact, it had that meaning in PL/I, back in the day. Interesting that
EBCDIC thought to make a place in its repertoire for “¬”, but ASCII did
not.
Lawrence D'Oliveiro
2024-09-05 07:07:41 UTC
Permalink
Post by fir
a·b·····
middle dot - terribly nice and good loking
The official international standard for a decimal point character, in
place of region-specific comma and full-stop characters.

Also, De Morgan’s theorems:

¬(A ∧ B) = ¬A ∨ ¬B
¬(A ∨ B) = ¬A ∧ ¬B

Or, if you like:

¬(¬A ∧ ¬B) = A ∨ B
¬(¬A ∨ ¬B) = A ∧ B

Loading...