11 ms·
Show HN: NoteCalc
- himujjal 6y agoGreat work. Is there a Terminal UI for this? Many users love to have simple programs in the Terminal itself.
- leejoramo 6y agoA version to use within VSCode would be very useful too.
- SamBam 6y agoI 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.
- bbodi 6y agoHi, 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.
- deleted 6y ago[deleted]
- mattweinberg 6y agoThis 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 https://soulver.app . I almost always have a Soulver window open on my screen.
- 32bitkid 6y agoJust wanted to also drop a recommendation for soulver, but I have been split between it and Calca (http://calca.io/ 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.
- tesseract 6y agoLove 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...
- frereubu 6y agoCalca 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!
- e_proxus 6y agoA 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.
- djbeadle 6y agoThis is very cool! The project description says that it is inspired by Soulver [1]. A similar (but different) application for iOS is Tydlig [2] which can also generate some simple x-y plots. [1] https://soulver.app https://soulver.app [2] http://tydligapp.com/ http://tydligapp.com/
- zaphod4prez 6y ago+1, I love Tydlig! Have used it as my main calculator for years
- whimsica1 6y agocheck-out numi app too! https://numi.app/ https://numi.app/
- enos_feedler 6y agoI wish this was built into the iOS notes app. So many notes are just number calculations like this.
- waynesonfire 6y agowow, love it.
- wongarsu 6y agoLink to the public instance: https://bbodi.github.io/notecalc3/notecalc 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.
- dvtrn 6y agoa link in the readme would be useful. It's there, already. The direct link in the OP are to the release notes https://github.com/bbodi/notecalc3/blob/develop/README.md https://github.com/bbodi/notecalc3/blob/develop/README.md
- xixixao 6y agoYou should link the website instead: https://bbodi.github.io/notecalc3/ https://bbodi.github.io/notecalc3/ Awesome work!
- ChrisMarshallNY 6y agoThat's really nice! Looks like a labor of love. Thanks for sharing it!
- Epskampie 6y agoSome feedback: it fills my browser history with a lot of entries.
- bbodi 6y agoThanks, 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.
- wccrawford 6y agoIf 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.
- bbodi 6y agoYes this will be, thanks :)
- triangleman 6y agoWow, 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!
- simlevesque 6y agoYeah it's Rust to WASM with JS for the startup.
- lxe 6y agoWow I didn't even notice this wasn't HTML until I tried pasting stuff...
- bbodi 6y agoI take it as a huge compliment :) 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 https://github.com/bbodi/notecalc3/issues
- codeful 6y agonotepad + calculator is a really great combination. i'm using this time to time: http://notepadcalculator.com/ http://notepadcalculator.com/
- chrisofspades 6y agoThis is pretty cool. Reminds me of https://instacalc.com/ https://instacalc.com/
- minxomat 6y agoAlternative for linux (especially great on eOS): NaSC (https://parnold-x.github.io/nasc/ https://parnold-x.github.io/nasc/)
- MadameBanaan 6y agoI'm enjoying it, but the lack of documentation is frustrating.
- gorkish 6y agoLove 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)
- vageli 6y agoYour 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.
- roywiggins 6y agoIt depends on the currency / country, too. Lots of countries put the currency afterwards, even "¢" comes after. $ and £ come before, but € ends up moving depending on the language. https://en.wikipedia.org/wiki/Language_and_the_euro#Written_conventions_for_the_euro_in_the_languages_of_EU_member_states https://en.wikipedia.org/wiki/Language_and_the_euro#Written_...
- deleted 6y ago[deleted]
- gorkish 6y agoBinary, 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$
- bbodi 6y agoIn 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/558a94779b3b3c5d89efeaa6/5fe0ae9f0b9791732fdf6901/d5b82722d364fc733850d1ef73ad4059/brave_TEMMNAnVJl.png 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.
- sanity31415 6y agoVery nice, reminds me of "literate programming": https://en.wikipedia.org/wiki/Literate_programming https://en.wikipedia.org/wiki/Literate_programming In a similar vein - a few years ago I built an open source REPL calculator called LastCalc (http://lastcalc.org/ http://lastcalc.org/), which supports some advanced ideas from functional programming including pattern matching.
- chedine 6y agoThis is great. I have always wanted to build this for myself ever since i read Bret Victor. Good work
- adrianmsmith 6y agoFor 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.
- gen_greyface 6y agoThis really looks great.. props to you. just a nitpick.. changing the theme resizes the panels automatically to adjust to the first panel's width
- bitexploder 6y agoThis 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.
- b3n 6y agoAny reason you don't use calc-mode to insert mathematical results into your Org buffer? Calc-mode is extremely powerful.
- monkeydust 6y agoVery 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.
- w0m 6y agoI usually use Alfred's build in Calc for simple stuff; and ipython when i want more (or reproducibility to play with numbers better)
- gregoriol 6y agoOn 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!
- filleokus 6y agoNumi 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
- asimpletune 6y agoI think the term in English is dimensional analysis
- nsajko 6y agoI'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.
- bbodi 6y agoOne 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.
- nsajko 6y agoYeah, 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.
- SamBam 6y agoVery 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.
- bbodi 6y agoThanks for noticing it! Unfortunately it seems units cannot be applied to function results. It must be fixed, I noted down, thanks!
- niklearnstodev 6y agoExciting to see an open source Rust WASM project as reference for us folks who are interested in playing around with it. Thanks for the cool work!
- smusamashah 6y agoThis is amazing. Doesn't feel like a web based tool at all. Can even do bitwise operations that's just great. Can there be a programmer mode where I can use & and | instead of AND and OR? Not a deal breaker though. It's going to help a lot in day to day bitwise stuff
- bbodi 6y agoyeah why not :) I added it to my todo.
- skulk 6y agoSomething like this exists for emacs as well: https://github.com/sulami/literate-calc-mode.el https://github.com/sulami/literate-calc-mode.el
- trungdq88 6y agoI've been trying to find a similar plugin for vim. Does anyone happen to know one? 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?
- JNRowe 6y agoI don't know of a plugin, but you can sorta do something kinda like the thing ish if you squint and cross your fingers... 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. ¹ https://vimhelp.org/popup.txt.html https://vimhelp.org/popup.txt.html ² https://vimhelp.org/syntax.txt.html#conceal https://vimhelp.org/syntax.txt.html#conceal
- lost-theory 6y agoI've looked into this a bit and the closest thing I could find is in VimWiki, where certain plaintext patterns are dynamically replaced with other text without actually changing the buffer. See how line 11 dynamically changes in this video based on whether his cursor is on the line: https://youtu.be/C0OwhiCp2Hk?t=223 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/619f04f89861c58e5a6415a4f83847752928252d/syntax/vimwiki.vim 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>
- FpUser 6y agoVery nice app, I really liked it
- krick 6y agoNice. What I really want, though is a CLI calculator (something like bc or ipython) that would be clever enough to handle stuff like 1000!/999! (increase the number of digits if python will be able to do that: I hope you get the idea). I cannot treat seriously a calculator in 2020 that actually tries to evaluate expressions numerically, while representing numbers as floats or int32. 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.
- muizelaar 6y agoHave you tried isympy? It handles your factorial expression easily.
- bbodi 6y agoOriginally NoteCalc used a library for handling arbitrarily large numbers. Unfortunately, some operations were so slow that as a quick fix, I replaced the library with a lighter one without dynamic allocations (which is 96 bit integer with 28scale). 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.
- kpgiskpg 6y agoI actually started working on a CLI calculator a few days ago that sounds exactly like what you're looking for: https://github.com/Kevinpgalligan/ka https://github.com/Kevinpgalligan/ka 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!
- mxb 6y agoFrink! https://frinklang.org/ https://frinklang.org/ sounds exactly what you want. It has built in bignum support and mathematical functions. It also does units and their conversation natively. 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.
- jarym 6y agoThis is soooo nice. I wish there was a +10 option on HN - it'd be the first time I'd use it!
- BOOSTERHIDROGEN 6y agois there a docker image ?
- chaoxu 6y agoThis is pretty good soulver replacement. 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.
- emmanueloga_ 6y agoThis looks amazing. Can the author explain the implementation choices? * 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.
- bbodi 6y agoHi, thanks :) 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-749095742 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.
- emmanueloga_ 6y agoCool! Makes sense. 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 https://www.w3.org/TR/2dcontext/#best-practices 2: https://stackoverflow.com/questions/12425111/creating-canvas-based-html5-text-editor https://stackoverflow.com/questions/12425111/creating-canvas...
- thesmok 6y agoIt sounded great, so I opened a demo page to try it out. Copied the contents of my personal savings note, and wanted to paste it into the NoteCalc to see what magic it would do. Pressed Cmd+V but it didn't paste. It just typed v intstead.
- smusamashah 6y agoOther similar tools http://mathnotepad.com/ http://mathnotepad.com/ can do graphs and bitwise operations as well https://dedo.io/ https://dedo.io/ http://notepadcalculator.com/ http://notepadcalculator.com/