top | item 30119699

(no title)

axby | 4 years ago

> I've setup my keyboard (on linux) so that the CAPS-LOCK key acts as a "dead greek" composer. If I press "CAPSLOCK+a" it types "α", and so on.

Cool! Is this because you type a lot of Greek (or math)?

> My unpopular opinion is that typing "alpha" should compute the product of the five values, equivalent to "a^2lph".

I wouldn't call it an unpopular opinion, that's how my physical graphing calculator worked, though it only had single letter variable names. The programmer in me likes my current way, though the (nearly long gone) engineering student cringes when I have to write things like "i*2*pi*f".

If people were mostly universally happy with single letter variable names then I could probably switch to this. If they were space separated then it would be a fairly simple change (except for the way units works, is "1 s" 1 times variable s, or 1 second? This is why I don't support 1 m/s to mean metre per second, it means "1 metre divided by variable s". 1 metre per second is "1 m s^-1").

I tried to compromise by making the UI automatically enter a multiplication symbol when entering tokens that aren't valid.

Perhaps if I added an additional input layer when typing then this would be feasible. Maybe something like pressing a special character, then typing "alpha" will convert it to the alpha character, and non greek letter variables could be wrapped in quotes or square brackets or something.

The one thing that would be lost is the ability to name a variable "x2". Maybe that's fine since "x_2" would still work.

As an update on unicode parsing, I still think it should be easy, but I'm running into issues. I quickly tried https://stackoverflow.com/a/11255698/9596600 but I'm seeing this:

    terminate called after throwing an instance of 'std::regex_error'
      what():  Unexpected escape character.
I suspect I just need to dig in on how to use these extended regexes (and remove some of my existing regexes). This weekend I might have more time to try it.

discuss

order

enriquto|4 years ago

> Is this because you type a lot of Greek (or math)?

Just regular math, where greek letters abound. A colleague mocked me because I was "still" writing \varphi instead of φ, so I learned to type the greek letters directly.

> (...) cringes when I have to write things like "i2pi*f".

In LaTeX you would write 2πif, in a "LaTeX calculator" as yours I'd expect to be able to do so!