Show HN: NoteCalc(github.com) |
Show HN: NoteCalc(github.com) |
just a nitpick.. changing the theme resizes the panels automatically to adjust to the first panel's width
Looks like a labor of love.
Thanks for sharing it!
Pasting should work with simple texts, what was the issue? Don't hesitate to open an Issue in GitHub if something does not work. https://github.com/bbodi/notecalc3/issues
> 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.
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.
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.
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.
It's there, already. The direct link in the OP are to the release notes
Also I noticed the base64/deflate URL fragment storing the entire text content, à la flems.io ... nice!
Multiplying matrices and stuff is nice, but I don't think I really ever needed that. But simple combinatorics and other calculations that involve large numbers and lots of simple operations (like powers), but are perfectly calculatable without losing precision on a piece of paper — plenty of times. It's annoying that I can calculate on a piece of paper something my calculator cannot.
Other than that, maybe some operations over physical units/unit conversion and some embedded city/timezone DB, and I don't think I can ask more of a calculator.
This serves well the primary goal of NoteCalc so I did not spend more time on it yet, but I am on the same page as you, and if NoteCalc will be feature-complete, I will give an other shot to arbitrarily large calculations/precision.
So far it just has variables and basic arithmetic. Other features on my roadmap: rational numbers, a type hierarchy, units, and lazy/smart combinatorics.
What do you imagine the timezone DB would look like? I'd love to hear your ideas!
It runs on top of the JVM so there's an Android port also. The Android app appears as two icons. One as a simple calculator and the other as a simple scripting editor for more complex requirements.
"$400 / 20" => 20 (ERROR)
"$400 / 25" => 25 (ERROR)
"400$ / 20" => 20 $ (OK)
"400$ / 25" => 16 $ (OK)
https://bbodi.github.io/notecalc3/
Awesome work!
A similar (but different) application for iOS is Tydlig [2] which can also generate some simple x-y plots.
Is there a Terminal UI for this? Many users love to have simple programs in the Terminal itself.
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.
Sadly I haven't found any equivalent for iOS (iPhone and iPad): it would definitely get my money!
[0]: Not sure of the actual term in English
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.
This could fit that sweetspot for me and others I imagine.
In a similar vein - a few years ago I built an open source REPL calculator called LastCalc (http://lastcalc.org/), which supports some advanced ideas from functional programming including pattern matching.
I found all these similar tools has the problem that there is exactly one expression per line.
Is there any exploration of this feature: have the computed number shown next to the expression.
I had this problem while using soulver, too. I had a lot of artificial line breaks. For calculations it is pretty good, but it is pretty horrible when I present it to someone else.
http://mathnotepad.com/ can do graphs and bitwise operations as well
pi() => 3.14...
sin(3.14 rad) => 0.00..
sin(pi() rad) => err
No idea why there's that error.Unfortunately it seems units cannot be applied to function results. It must be fixed, I noted down, thanks!
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.
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.
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.
* Why WASM?
* Why Canvas?
From what I could see, it seems to repaint the whole canvas every frame, so I'm guessing this uses a custom implementation of immediate mode GUI.
Why WASM:
One of the primary goal of NoteCalc is to be easily accessible (e.g. it was mainly born because Soulver is MacOS only). So the browser-based client was obvious choice, and I chosed WASM for
- performance reasons
- to be able to use rust
- to avoid as much JS (and related technologies) as possible
Why Canvas:
I answered here: https://github.com/bbodi/notecalc3/issues/6#issuecomment-749...
In a previous versions, only the changed areas were re-rendered, but the code was much more complex and error-prone, and it did not bring any performance improvement, so now I just rerender everything, still excellent performance but much simpler code. However this is different for calculations, only changed/affected lines are reparsed and recalculated.
Any advice / learnings on using canvas from wasm for this kind of GUI stuff? If I get it right, you just implemented the editor yourself, not using any sort of widget system.
People often recommend not trying to implement editors on top of canvas because of ... reasons [1] [2], but it seems your implementation ended up being pretty simple? (at least in terms of lines of code...).
1: https://www.w3.org/TR/2dcontext/#best-practices
2: https://stackoverflow.com/questions/12425111/creating-canvas...
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.
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.
https://en.wikipedia.org/wiki/Language_and_the_euro#Written_...
-$4000CAD
CA$-4,000.00
4.000,00CAD$
In fact, I have never seen a vim plugin that add a "notation" at the end of each line like this one. Is it something very difficult in vim?
You can perform actual in-place calculations by using the expression register. So for example:
= 2 + 2
<insert mode cursor here>
Then something like `<C-r>=eval(getline('1h')[2:])` will end up with: = 2 + 2
4
If you regularly did so writing a more robust mapping would probably useful.And using regular :global you could perform similar operations across a file with `:g/^= / <expression replacement>`
I think the real solution would be just to use evil-mode in emacs when you wish to use things like literate-calc-mode. I do that for org-mode because it is just so much more powerful than the basic vim plugin for org-mode files.
> Is it something very difficult in vim?
Since 8.2 was released you can use popupwin¹ to emulate something similar. I'd probably give it a go if you wrote it :P
It is a real shame you can't use a funcref(or even multiple characters) for conceal replacement, or you could simply add a conceal² for => to show the result. Such functionality would also be nice for inlining computed types in various languages too.
See how line 11 dynamically changes in this video based on whether his cursor is on the line:
https://youtu.be/C0OwhiCp2Hk?t=223
I believe this is done using "conceal" as JNRowe says, e.g. here:
https://github.com/vimwiki/vimwiki/blob/619f04f89861c58e5a64...
I also second what JNRowe says about trying the new popup feature. I recently used this to run a script that calculates something based on where my cursor is currently at in the file, then show the result at the cursor using a popup:
fun! CalculateFoodCalories()
let day = GetSectionName()
let day = substitute(day, "\[", "", "g")
let day = substitute(day, "\]", "", "g")
let out = split(trim(system("food --date=" . day)), "\n")
call popup_atcursor(out, #{ title: "Today's calories", highlight: 'Statement', border: [], padding: [1,2,1,2]})
endfun
nnoremap <silent> <leader>m :call CalculateFoodCalories()<CR>I would look into using popups, a separate pane, or something like vim-notebook.