For the past month or so my main spare-time project has been a crazy idea called LastCalc (link at bottom).
I’ve been having trouble figuring out how to describe it, but here goes: Imagine a powerful web-based calculator that can answer your questions, a little like Google Calculator, Siri, or Wolfram Alpha, but where anyone can teach it how to calculate new things.
Additionally, rather than asking one question, you can ask a series of questions, each potentially referring to previous answers (programmers know this is a Read-Eval-Print-Loop or REPL).
Just like the others it supports basic math and unit conversions, like this (note: the highlighting is automatic and happens as you type – you type the bit before the big silver = and hit return, the answer appears after it):
But it goes a lot further. You can assign the result of a calculation to a variable, and then use it in subsequent calculations:
Internally LastCalc treats all numbers as rationals (x/y where x and y are integers) if possible, even if they are displayed as floating point numbers. This means that it will not lose precision regardless of how many calculations you do (this can be a problem if using normal floating point numbers which are imprecise).
It’s not just simple numbers, LastCalc understands lists and associative arrays too, using a syntax very similar to JSON:
LastCalc is extensible, so if you find yourself repeating the same calculation over and over again, you can teach LastCalc how to do it (note: parameters are denoted by capitalization, like Prolog):
And it goes further, supporting pattern matching and recursion using these datastructures, just like languages like ML and Haskell:
Then use it with:
You can also pattern-match on maps. Here I define a function that takes a map and returns a list of its keys:
Currently I’m working on a tutorial and help system so I don’t need to explain all of this before sending people to the site 🙂
Right now you can only use functions that you define yourself, but in due course people will be able to share functions, much like they can share answers to questions with Quora.
Check it out at LastCalc.com.