Calculator mode like numi or soulver

I find the calculator for Numi[1] and Soulver[2] to be very useful for day to day tasks but not worth having in a separate apps. It’d be possible to add a block type that implements a limited subset of Numi and make it very convenient to use inside Logseq

I’m happy to implement this myself, I made a prototype parser using Instaparse this morning and it already supports the features I need (basic arithmetic and variable assignment)

Design wise we could embed it in a code block like this:

[1] https://numi.app/
[2] Soulver | Acqualia

6 Likes

Hi, this is a great idea! Your work on Clojurescript is amazing too!

Exciting to know that you already make it work, the plugins API is still in development, we can add this to the core and move it later to a plugin.

Can you send a PR so that we mortals can use it?:grinning_face_with_smiling_eyes:

2 Likes

Sweet! First PR is here I’ll follow up with a second one soon.

6 Likes

:rocket: trully amazing!

1 Like

so great !
is a variable remembered inside the same code block or is it page wide ?
It would be awesome if we could store a result as a global persistent variable or somehow pass it to a property::

In the current implementation I’m working on, the calc’s environment (mapping between variable names and computed values) is local to calc’s editor component. After I put that one up, we can discuss exposing the environment to the rest of the page. Scoping rules are not as straightforward in a context that is best model by graphs (and not by trees!)

2 Likes

got it, thanks again for this great addition to logseq’s toolset.

4 Likes

Closed as feature is part of latest release