Live data from Hacker News

Show HN: NoteCalc

github.com

61–70 of 79 posts

Re: Show HN: NoteCalc

#61

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 usabi…

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!

Re: Show HN: NoteCalc

#63
This 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.

Re: Show HN: NoteCalc

#64
post #4

This 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 [2] http://tydligapp.com/

+1, I love Tydlig! Have used it as my main calculator for years

Re: Show HN: NoteCalc

#65
post #54

Something like this exists for emacs as well: https://github.com/sulami/literate-calc-mode.el

I'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?

Re: Show HN: NoteCalc

#66
This 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.

Re: Show HN: NoteCalc

#67
post #56

Nice. 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…

I 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

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!

Re: Show HN: NoteCalc

#68
post #54

Something like this exists for emacs as well: https://github.com/sulami/literate-calc-mode.el

I'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?

I 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
    
Then something like `=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/^= / `

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/syntax.txt.html#conceal

Re: Show HN: NoteCalc

#69
post #54

Something like this exists for emacs as well: https://github.com/sulami/literate-calc-mode.el

I'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?

I'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

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  m :call CalculateFoodCalories()

Re: Show HN: NoteCalc

#70

This 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.

Hi, 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-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.

Post reply on HN