78 comments

[ 3.2 ms ] story [ 154 ms ] thread
Great work.

Is there a Terminal UI for this? Many users love to have simple programs in the Terminal itself.

A version to use within VSCode would be very useful too.
I was just thinking, turning this into a VSCode plugin would be awesome. Would save me from opening up the browser console every time I wanted to do some simple math.
Hi, Not yet, it is on my list, but unfortunately with a low priority.

But fortunately, the whole architecture was designed with the terminal in mind: - 99% of the functionalty is implemented as a lib, and just a tiny part is responsible for input and rendering, so it is very easy to write new frontend for it. - both the rendering and the input uses characters as a basic for coordinates, so it is easy to translate the render commands generated by the lib to the terminal.

(comment deleted)
I wish this was built into the iOS notes app. So many notes are just number calculations like this.
This looks great! The README says:

> Honestly, it just tries to be a free Soulver alternative in your browser.

For people on macOS, Soulver is excellent and worth checking out: https://soulver.app . I almost always have a Soulver window open on my screen.

Just wanted to also drop a recommendation for soulver, but I have been split between it and Calca (http://calca.io/) which I think is _also_ worth checking out, if you like this kind of hybrid notes/calculator like interface.

The ultimate interface _for me_ would be somewhere in between Calca (which I think has superior support for functions/graphing/logical calculations) and Soulver (which I think has better usability/readability) and a graph-based note-taking system like Obsidian/Zettlr. I'm sure somebody will say "there is a Vim plugin that'll do that" but… yea.

Love Soulver and Calca looks great too, thanks for pointing that out! Personally I would love a tool like one of those but with built in unit handling/dimensional analysis capabilities equal or better to the Google search bar...
Calca does look like a really nice mix of note-taking and calculations. The screenshots made me realise I was missing variables in Soulver... until I looked at the Soulver docs and realised that it does have variables, I just hadn't thought to look. Thanks for the prompt!
A big plus for Calca is the mobile app and automatic syncing via iCloud on Apple devices.

Not sure if Soulver is newer or less “complete” than Calca, but it is being updated at lot more often. The updates for Calca are very sparse and leads me to think it’s more in a maintenance mode.

Link to the public instance: https://bbodi.github.io/notecalc3/notecalc

It took me a couple clicks to find, a link in the readme would be useful.

It's an awesome tool, I think I will use this a lot. It cover 95% of my WolframAlpha use, with an interface that's both more responsive and let's me keep track of context and streams of thought.

That's really nice!

Looks like a labor of love.

Thanks for sharing it!

Some feedback: it fills my browser history with a lot of entries.
Thanks, you are right, I did not notice but yes it could be annoying.

The reason is that the content of the note is stored in the URL so it is easy to share it by sending the url to friends. So the URL changes basically on every modification.

I add it to the fixlist.

If you aren't interested in the history, perhaps you should be replacing the state instead of adding to it? Without looking at the code, it seems like an easy fix.
Yes this will be, thanks :)
Wow, so this is rust compiled to JS? Or I guess WASM which is a subset of JS? Is this the future of the web?

Also I noticed the base64/deflate URL fragment storing the entire text content, à la flems.io ... nice!

Yeah it's Rust to WASM with JS for the startup.
Wow I didn't even notice this wasn't HTML until I tried pasting stuff...
Love this, but the lack of interpretation of prefixed currency symbols is absolutely maddening! That it simply ignores the number and operand with no indication that these elements are ignored could easily lead to problems. I don't think I could in good conscience trust myself or those I might consider to be the target audience of this app to notice parsing errors in every case. Consider:

"$400 / 20" => 20 (ERROR)

"$400 / 25" => 25 (ERROR)

"400$ / 20" => 20 $ (OK)

"400$ / 25" => 16 $ (OK)

Your comment made me realize that most unit notation I'm familiar with has the unit as a suffix, with currency being the only standout that comes to mind.
(comment deleted)
Binary, ocatal and hexidecimal literals often are indicated with prefixes: 0b, 0 and 0x respectively. There are probably other esoteric cases that I can't think of off the top of my head. "Qty" is often prefixed, for instance. It's a complicated problem for a natural language calculator, to be sure. Here are a couple examples of ways to represent four thousand Canadian dollars that you might encounter and have no trouble interpreting as a human. This could be a good target for an ML tokenizer...

-$4000CAD

CA$-4,000.00

4.000,00CAD$

In your case syntax highlighting helps. Everything which is not part of a calculation is rendered as a simple text (greyish): [image](https://trello-attachments.s3.amazonaws.com/558a94779b3b3c5d...)

But yes I admit it takes some time to get used to the colors and their meanings.

Currencies and exchange between them are on my feature list btw.

Awesome; this is great to hear.

An idea you might consider is to display some kind of warning symbol or message if the input contains digits or operands which are not interpreted as part of the calculation that produces the output. This would have made the semantic meaning of the syntax highlighting immediately more evident.

This is great. I have always wanted to build this for myself ever since i read Bret Victor. Good work
For those using note-taking apps, I've found that OneNote has a similar very useful feature. If you type 1+2= into a note and then press the space bar, it'll insert the answer. It can understand thousand separators and large expressions with brackets etc.
This really looks great.. props to you.

just a nitpick.. changing the theme resizes the panels automatically to adjust to the first panel's width

This is really cool. I am always in Org mode which lets you do "literate" programming as well. I think NoteCalc is a little more streamlined, but I am very used to throwing a little Python or elisp into my notes when I need to do math. Great to see more options on this front. Org-babel is a nice package, though it does have some limitations.
Any reason you don't use calc-mode to insert mathematical results into your Org buffer? Calc-mode is extremely powerful.
Very nice. I end up using google search more frequently for simple calcs and have been wanting something to take that to another level but not as far as a full blown Juypter notebook.

This could fit that sweetspot for me and others I imagine.

I usually use Alfred's build in Calc for simple stuff; and ipython when i want more (or reproducibility to play with numbers better)
On macOS, there is the excellent Numi app

Sadly I haven't found any equivalent for iOS (iPhone and iPad): it would definitely get my money!

Numi would be my favourite of all these kind of calculators on macOS, if it wasn't for the lack of unit calculations[0], e.g density = 2 kg / 3 l, mass = 10 dm^3 * density

[0]: Not sure of the actual term in English

I think the term in English is dimensional analysis
I'm not quite sure what's the purpose of either NoteCalc or Soulver, but I am currently getting acquainted with TeX - and from that perspective NoteCalc seems comically under-powered compared to what's achievable through plugging into the Lua(Meta)TeX engine with Lua, or with the Lua C API.

I'm not criticizing NoteCalc, rather I think somebody should create a lightweight note taking tool like that, I don't think it would be very difficult by leveraging the already existing TeX/ConTeXt/LMTX/LuaMetaTeX machinery, and it would blow the Soulver-like stuff out of the water. The main design problem could be deciding exactly where between ConTeXt and Soulver should the new tool/language lie power-wise, i.e., how much should it expose.

I'm not proposing using TeX directly, rather I'm proposing basing a new, simpler language on the Lua(Meta)TeX TeX engine, and probably also on ConTeXt/LMTX.

One of my primary design goal was something like that: "My mother should be able to use this tool to calculate/plan her vacation expenses". (My mother is older and not a tech guru you can guess :)) So the primary focus are on simple calculations with meaningful context and immediate feedback. Nothing fancy.

Though, beside that, I think it provides some nice features. E.g. the matrix creation/editing functionality was born because I could not find a simple tool to double check my rendering calculations with.

Yeah, I guess NoteCalc will be useful to many people, it's just that I'm noticing the sad lack of utilization of LuaTex (probably because people don't know it exists and exposes the power of TeX through Lua).

The targets of NoteCalc vs. the tool I'm proposing would be somewhat different, too, because LuaTex outputs primarily to PDF, and I don't know if it can produce HTML.

Very cool, though I find there's a lack of discoverability as to what I can do with it, and no help is provided if there's an error.

    pi() => 3.14...
    sin(3.14 rad) => 0.00..
    sin(pi() rad) => err
No idea why there's that error.
Thanks for noticing it!

Unfortunately it seems units cannot be applied to function results. It must be fixed, I noted down, thanks!