Maybe there's already a way to do this, but it seems to me that it would be useful to be able to refer to the answer on a previous line, like the Ans key on a TI calculator. So: 2 + 3 (=4) Ans * 2 (=8)
x * 2
171–180 of 246 posts
Maybe there's already a way to do this, but it seems to me that it would be useful to be able to refer to the answer on a previous line, like the Ans key on a TI calculator. So: 2 + 3 (=4) Ans * 2 (=8)
x * 2
Earlier quoted context omitted.
And `mpg`/`l/100k` please!
I've avoided adding mpg because the UK and US disagree on what a gallon is and mpUKg/mpUSg is not very nice to look at. You can write "miles per gallon" or "miles per US gallon" because per is the same as the "/" operator, and you can sort of do "L/100km" but you can't convert to it. I'll have to think some more about this one.
Nice - I'll give it props for: > 1 metre + 8 chain = 161.9344 m > 1 tonne + 1 short ton = 1.90718474 t > 1 tonne + 1 long ton = 2.0160469 t and give it a pass for not supporting pre 1963 UK | US historic weights and measures .. that's getting into a pretty specific use case where Standards nerds like to have a clear display of what conversion factors are in play and what provenance those factors have. Time Zone suppo…
Didn't tell me how much 8 gills[1] would be in liters (about 1) [1] https://en.wikipedia.org/wiki/Gill_(unit)
> 14 furlongs / 2 weeks in mph [0.0052083333 mph]
I like how you are using a Gist for the exchange rates ( https://gist.github.com/tonyonodi/e154f529180b1f0f475966d333... ), do you have a GitHub action setup to automatically update that?
Impressed you found that. I don't have anything set up to automatically update it currently, but I do have an intention to have something set up to automatically update it.
> 100 eur to usd $-100.63 > 100 usd to eur Incompatible units
I wish it could be something lightweight and launched as a native app.
Earlier quoted context omitted.
Yeah, honestly this has been annoying me too, I just haven't got around to fixing it. It's using CodeMirror 6 as the editor, the author said he deliberately made this version not "break" the default tab behaviour, which I think is understandable as a library author, but that makes it my job to fix!
I thought CM had some example code on how to override the tab behaviour. Might be worth checking out as I agree it sucks to not have tab = indent 4 spaces
(ducks) (but srsly)
Super cool. I wish this was open source so I could see how you did some things, but I understand you've decided to keep it closed. Just to satisfy my curiosity, would you mind sharing how you did parsing at a high level? Did you use some publicly available parser/lexer or did you just implement pattern matching yourself with something like regex or other token splitting measures?
But to give you an idea of what that all looks like this is the code for the parser that parses the "as a % of" operator:
append(
string("as"),
oneOrMore(space),
optional(append(string("a"), oneOrMore(space))),
percentSymbol,
oneOrMore(space),
string("of")
)
[0] https://github.com/bodil/eulalie2+2 -> 4 ok 2+2 2 -> 6 ok 2+2 2-3 -> 0 What?
Super cool. I wish this was open source so I could see how you did some things, but I understand you've decided to keep it closed. Just to satisfy my curiosity, would you mind sharing how you did parsing at a high level? Did you use some publicly available parser/lexer or did you just implement pattern matching yourself with something like regex or other token splitting measures?
I've found that a super simple way to parse basic expressions is a recursive descent parser. It is very simple to implement. No need to to break into tokenizer/parser, no need to generate an AST, just evaluate the expression while parsing.
It would be nice if "1 mm / inch" would be returned as a unitless number. I know that you can enter "1 mm in inch" but there are cases where it would help to have the calculator reduce the units for you.