9 ms·
A calculator for the Terminal that renders beautiful math
- webdva 7y agoVery good design skills.
- deleted 7y ago[deleted]
- johnklos 7y agoIt's beautiful! It's a real shame that Haskell isn't portable.
- jdc 7y agoWhat modern desktop or server platforms does it not run on?
- pabs3 7y agoIt seems to build on all the Debian ports, except SuperH and kFreeBSD, neither of which are modern desktop or server platforms. https://buildd.debian.org/status/package.php?p=ghc https://buildd.debian.org/status/package.php?p=ghc
- SkyMarshal 7y agoIt seems not to run well on some platforms like the minds of developers who don't want to take the time learn it.
- aratakareigen 7y agoWhat do you mean? Haskell has, last time I checked, an LLVM IR and a C backend, so it should be very portable.
- mightybyte 7y agoHaskell can build for Linux, Mac, Windows, iOS, Android, and it can also compile to JavaScript. I don't know what your particular need is, but that fits my definition of portable.
- pmkary 7y agoWhen I have the time I will port it to JavaScript to make it universal on all systems. But for now it only works on desktop machines that run Haskell. The installation script is only good for the UNIX for the time but I will add for windows
- dan-robertson 7y agoThere’s ghcjs right? So maybe not super hard to port the core. I have basically no idea though.
- nine_k 7y agoAh, such a nice set of features, and case-insensitive identifiers?.. I mean, if I do math or physics, I usually follow conventions, so I expect G to be usable as the gravitational constant, while g to be usable as the free-fall acceleration, maybe in the same formula.
- mkl 7y agoYes, that seems a very strange choice (stranger than spaces in identifiers!). TikZ allows spaces in some identifiers, and it can be quite nice.
- pmkary 7y agoStay tuned and I will push an update for you guys to have lowercase/uppercase single letters. You can currently use single letter latin instances like Beta and Beta'
- mkl 7y agoWhy "Beta" and "Beta'", not "beta" and "Beta"? (Following e.g. Latex.) It seems like it would be useful to be able to define identifiers like "Φ'" (though maybe that's "Phi''"). It also seems a bit inconsistent to not allow an identifier π to be defined - some people use the symbol π for other purposes.
- pmkary 7y agoThat is because the language is case insensitive and therefore normalizes the words so Beta and beta will not differ once they pass the parser.
- IshKebab 7y agoThat's a bad idea - every system that is case insensitive has eventually regretted it because it just leads to confusion. E.g. Mac's filesystem, Cmake (https://stackoverflow.com/a/35034125/265521 https://stackoverflow.com/a/35034125/265521). Almost all modern languages are fully case sensitive.
- Wevah 7y agoNeat! One documentation nit: “Parenthesis” is singular; the plural is “parentheses”.
- lilyball 7y agoThis looks very neat, but why does the project have zero tags or releases? I also notice the GitLab instance isn't even accessible over https.
- sytelus 7y agoIt's amusing to see lot of people will write so much code and then skimp on just few lines of install script. The author here expects that everyone knows Haskel and how to install its "stack". 5 stupid lines of the install script. What fractions of time that would have taken in the total time spent on this project?
- pmkary 7y agoQuite right. I used to be on GitHub and they banned me because of my nationality. So I had to make my own server. I still haven't had the chance to made the SSL work, sorry for that, but issues were really bigger than that so...
- ivan_ah 7y agoNice to have all that power on the command line. The system uses the notation with square brackets for function calls, e.g. Sin[x], so ppl familiar with Mathematica will feel right at home. The SymPy Unicode output mode also does a pretty good job on the command line. You can try here https://live.sympy.org https://live.sympy.org, for example https://live.sympy.org/?evaluate=(1%2F2)%2F3%20%2B%202%2Fsqrt(sin(pi%2F2)**2%2Bcos(pi%2F2)**2)%20%2B%20floor(E%2F2)%0A%23--%0A(19%2F6).evalf()%0A%23--%0A https://live.sympy.org/?evaluate=(1%2F2)%2F3%20%2B%202%2Fsqr... (see Settings on the side to turn off LaTeX rendering)
- pmkary 7y agoYeah but it wasn't the prettiest. What I learned through my experiments was that not all of the notations render beautifully and so I chose a subset that is pretty and kept the rest rendered just as functions. This honestly wasn't a try to have full mathematical notation rendering, but rather my own preferences of notation rendering. Yet, I hope you enjoy it :D
- dan-robertson 7y agoI guess the Unicode output is nice but I feel like my biggest issue is one with input. One thing that is annoying is you get half way through your line and realise you need an opening paren several terms ago. It can take a load of time to find the place to put it and a load of effort to make sure things are correctly balanced. I feel like the operator I wish I had is something like “extend the left operand leftwards” e.g. go from this (with cursor represented by a bar): a + b * x + c /| to this: a + (b * x + c) /| And apply again to get this: (a + b * x + c) /| It (e.g.) let’s you write fractions without needing to use loads of parens (which have a cost as they must be balanced) or needing to think about whether the numerator will have more than one term. I guess with rich input I’d also want to see the output in “big” mode. Another way to try to make input easier is to use rpn. This has advantages and disadvantages. Currently the calculator I most use is gnu Calc (I also use R occasionally for calculating quantiles). GNU Calc is the calculator built into emacs. It has an rpn interface and an algebraic one. A nice feature of the algebraic interface is that you can use $ to mean “the top entry on the stack” and so you can incrementally build up an equation. A second feature is selections. Their internal implementation is weird (based on hidden “functions” and rewrite rules) but they work fantastically well for modifying and manipulating the inside of a formula or equation. It also has a “big” display format which looks a bit like this one except that it predates Unicode symbols being common and so is pure ascii. (It also has tex output and emacs has image support but no one has put the two together yet) Mainly I use Calc because I’m in emacs anyway and it has a ton of features that are easy to access (eg arbitrary precision floats, bignums, modular arithmetic support, complex numbers, interval arithmetic, vectors, matrices, algebra, curve plotting/fitting, unit conversions, ...). I feel like the variable support isn’t great. I feel like I want to eg have some set of variables, defined to be various input numbers, and write formulae in terms of them and then get the formula on the left without variables substituted and it’s numeric evaluation (with them substituted) on the right. There’s something weakly like this using => but it doesn’t compose well. If you add a => 1 to b => 3, you don’t get a + b => 4, you get (a => 1) + (b => 3). (I think. My memory is a bit rusty for the last example).
- tomxor 7y agoview-source:https://kary.us/nota/install.sh https://kary.us/nota/install.sh -> http://codes.kary.us/nota/nota.git http://codes.kary.us/nota/nota.git
- wizzwizz4 7y agoOr fix the SSL. One of those must occur before this works.
- tpmx 7y agoLooks a bit like Mathcad for DOS back in the 80s: https://en.wikipedia.org/wiki/Mathcad#/media/File:Mathcad_252_screenshot.png https://en.wikipedia.org/wiki/Mathcad#/media/File:Mathcad_25... https://books.google.com/books?id=zjAEAAAAMBAJ&lpg=PA63&dq=mathcad&pg=PA64#v=onepage&q&f=false https://books.google.com/books?id=zjAEAAAAMBAJ&lpg=PA63&dq=m...
- dukoid 7y agoMy favorite tool to double-check O:) my math homework was derive https://en.wikipedia.org/wiki/Derive_(computer_algebra_system) https://en.wikipedia.org/wiki/Derive_(computer_algebra_syste...
- dukoid 7y agoShameless plug: If you prefer java, try https://github.com/stefanhaustein/expressionparser/blob/master/README.md#tree-building https://github.com/stefanhaustein/expressionparser/blob/mast... Bonus feature: symbolic derivation
- navigaid 7y agoA mirror for those who are unable to git clone: https://github.com/pmkary/nota
- sriku 7y agoParts of this reminded me of Calca (https://calca.io https://calca.io)
- pmkary 7y agoWow you're absolutely right! It was a big inspiration for me
- qubex 7y agoThe use of brackets to denote function arguments and pretty text output in the terminal reminds me very strongly of using Mathematica from the command line. https://reference.wolfram.com/language/tutorial/UsingATextBasedInterface.html https://reference.wolfram.com/language/tutorial/UsingATextBa...
- pmkary 7y agoYou are very right. I studied the screenshots of Stephen Wolfram's earlier project SMP and later the early versions of Mathematica. And the Calca later was a language inspiration.
- Aardwolf 7y agoI always found it odd about Mathematica that a low level programming language like C gets closer to mathematical notation with sin(x) than Mathematica with Sin[x]
- pmkary 7y agoThere are two reasons; first is that I tried to render parentheses in the terminal and they didn’t look good, it was brackets that looked good. So that is the actual reason but also writing brackets do not require shift so I prefer it myself to type more easily
- choeger 7y ago> but also writing brackets do not require shift So your target audience is strictly (US) English?
- Cu3PO42 7y agoThis, and issues like it, bug me so much. So many keyboard shortcuts are unusable by default on QWERTZ, for example any shortcuts involving /, [ or ]. They require modifiers to be typed, so those are swallowed for shortcut purposes. Of course, it is (almost) impossible to account for the enormous amount of keyboard layouts that exist, so I wish we could agree to use key positions over the characters they produce for shortcuts, so we can cover a significant portion of the population with ANSI/ISO layouts. I'm honestly not sure what keyboard layouts are used in countries with entirely different scripts, but my cursory Google searches suggest the physical layout is the same as ours. Sure, you might lose some mnemonics on layouts that aren't QWERTY, but at least the majority of shortcuts would be usable by default compared to having to remap them in every application. The application could even resolve what keys are actually mapped to the physical keys and display the correct shortcut in menus. Destiny 2 actually seems to do this and does, as far as I was able to tell, an excellent job of it.
- albertzeyer 7y agoI hope that we will eventually get image support in terminals, and then projects like this can be much easier and still much nicer and more powerful, e.g. also plotting graphs, and much more, similar as what you get in a Jupyter notebook. There is a long ongoing discussion about an upcoming standard for image support in terminals: https://gitlab.freedesktop.org/terminal-wg/specifications/issues/12 https://gitlab.freedesktop.org/terminal-wg/specifications/is...
- fit2rule 7y agoWe've had image support in terms possible for years. I don't think that's what's needed to make a nice command line math program. Instead, we need term programs that can handle type ligatures better. Being able to use something like FF Chartwell in a terminal would be amazing .. and would lead the way to having properly formatted mathematical notation in the terminal, without requiring a new standard to implement. Ligatures are already a thing - they just need to be better supported by the term apps.
- albertzeyer 7y agoYou probably mean SIXEL? That is very limited, has drawbacks, and is not supported by many terminals (not exactly sure why, maybe too complicated, or too ugly). It's also discussed exactly in that thread. Developers from tmux, iTerm, mintty, xterm.js, Kitty, and others are in there.
- tempodox 7y agoIt does look nice, but it seems to be missing complex numbers.
- pmkary 7y agoYeah. those beasts. I really like to have them implemented someday!
- L0stLink 7y agoI use Insect[0][1] as my calculator and it is great and does not have the odd choice of having case-insensitive identifiers plus does not require me to have Haskell installed. I would prefer if Insect was written in a compiled language but I am glad that it exists and JavaScript is really not a deal breaker for me as I need nodejs installed anyway (the same cannot be said for Haskell and this is going to be true for most people) plus you can get "compiled" single binaries for it from the release page[2] that you can put in `~/.local/bin` and not worry about it. I highly recommend trying it out. A bit slow to start but if your window manager supports hiding/showing bound windows through user defined shortcuts (like bspwm, awesomewm, i3, sway, herbstluft and most other tiling window managers) then you can just have it launch in the background on startup and you will have a convenient calculator just a few keystrokes away. [0] https://insect.sh/?q=%3F https://insect.sh/?q=%3F [1] https://github.com/sharkdp/insect https://github.com/sharkdp/insect [2] https://github.com/sharkdp/insect/releases https://github.com/sharkdp/insect/releases
- noja 7y agoBeauty sure has a low standard these days.
- pmkary 7y agoOr we may call it different tastes :D
- lilyball 7y agoI'm surprised the gitlab page has no issues, and the Nota.cabal file still points to what appears to be a stale github repo.
- setr 7y agoA beautiful language with a beautiful notation and beautiful ideas is perhaps a bit too much beauty for my taste
- seanhunter 7y agoLooks really cool, but this statement > Nota approaches identifiers much differently than any other language. is not actually true. Goldman Sachs have an internal language, Slang, which also allows internal spaces in identifiers, and where identifiers are case insensitive. I believe it originated as an MIT research language so probably there are others with a similar approach.
- saagarjha 7y ago> Goldman Sachs have an internal language I think we can forgive them for saying that if the exception is not readily available.