9 ms·
Modern languages do have unicode operators. See for example Julia[1] and Raku[2] [1] https://docs.julialang.org/en/v1/manual/mathematical-operations/#Numeric-C
by zokier 3y ago
Modern languages do have unicode operators. See for example Julia[1] and Raku[2]
[1] https://docs.julialang.org/en/v1/manual/mathematical-operations/#Numeric-Comparisons https://docs.julialang.org/en/v1/manual/mathematical-operati...
[2] https://docs.raku.org/language/operators.html https://docs.raku.org/language/operators.html
- toastal 3y agoAgda & PureScript support it, Haskell with the Unicode pragma too
- lizmat 3y agoNote that the Raku Programming Language has pure ASCII equivalents for all operators as well, for the Unicode challenged. E.g. ≠ vs !=, ≤ vs <=, ≥ vs >= etc. etc.
- sundarurfriend 3y agoSame with Julia too.
- nottorp 3y agoThat's fun but how do I type them?
- chrismorgan 3y agoA Compose key is the best general-purpose way. For example: • ≥: Compose > = • ≠: Compose / = You can define your own sequences too, if you want. I like to type exactly what I mean, including curly quotes and dashes and narrow no-break spaces and emoji and so on, but often didn’t like the default mappings (if there were any). As an example, I use this for curly quotes (look at the keys’ locations on the keyboard to understand—it’s coherent): <Multi_key> <semicolon> <semicolon> : "‘" <Multi_key> <apostrophe> <apostrophe> : "’" <Multi_key> <colon> <colon> : "“" <Multi_key> <quotedbl> <quotedbl> : "”" (The only thing I can think of where I don’t normally type what I’d theoretically like to is hyphens, where I use ASCII’s HYPHEN-MINUS instead of the proper HYPHEN. I’ve never come up with a mapping I like—what with en dash, em dash, minus, &c.—and it’s also too common for fonts to lack a HYPHEN glyph.) When you’re used to this sort of thing, it comes completely naturally. Somewhat more information: https://en.wikipedia.org/wiki/Compose_key https://en.wikipedia.org/wiki/Compose_key
- nottorp 3y agoFun but I tend to type code fast. Really dont need an extra modifier key. Not to mention there isnt one on your regular keyboard.
- chrismorgan 3y ago> Fun but I tend to type code fast. When you’re used to it, and given the comparative infrequency of the characters you use it for, it’s not much of a burden—just ~three key presses instead of one. > Really dont need an extra modifier key. Note that Compose isn’t a modifier key in the most common understanding of the word: you don’t hold it down while you press the others (which would certainly be awful for its ergonomics), but you press keys in sequence. > Not to mention there isnt one on your regular keyboard. On my current laptop I map RAlt to Compose. On my previous laptop, it was RMenu. There’s always at least one key there that you literally never need to use, and I find the ergonomics for thumb usage very comfortable. (But I really wish Space was split into at least two keys. It’s so stupidly large.)
- kps 3y ago> (But I really wish Space was split into at least two keys. It’s so stupidly large.) If you can stand the tiny distant Return, get a Japanese keyboard.
- kps 3y agoMicrosoft's clumsy extension of IBM's short-sighted PC keyboard (and CUA) has a lot to answer for. It's too bad they didn't do a better job of ripping off either Apple keyboards or Unix workstation keyboards. I personally use AltGr (Mac Option) more than compose, since it's tractable to have almost the same layout on *nix and Mac. IIRC the default Mac layout has ≠ and ≤ ≥ in the obvious places, and they are just as easily touch-typed as shifted characters. Compose is nice (on xkb systems) in that it's very easy to add personal customization to ~/.XCompose for task-specific characters.
- layer8 3y agoIt’s not a modifier key, it’s a separate key you type before, like an escape character. I use the Caps Lock key for it. For very common sequences that you always want to have mapped you can use a tool like AHK so that you don’t have to press Compose before. The beauty of Compose though is that it works everywhere, and that it gives you access to a much larger character set in a very mnemonic way. For example, “ga” can map to “α” (“greek a”), “gb” to “β”, and so on. “2-” can map to “–“ (en dash), “3-“ to “—“ (em dash), “3.” to “…”, “c,” to “ç”, “i,” to “į”, “e,“ to “ę”, and so on. There are a lot of patterns that apply to a whole range of characters, it’s a bit like how commands combine in Vim.