A simplifed alternative to the excellent coffeeshop which attempts to make the scripting experience less weird. The entire script is translated instead of the individual function source, meaning we don't have eval issues that rely on the window
object to access variables outside the function scope and we have consistent behaviour between runs.
This is intended as a toy for helping get my head around Geometric Algebra.
Some nice features:
- The value of the last expression is displayed in the output console.
- Ctrl + R (Run), Ctrl + S (Save)
- Can use the
print
andgraph
functions to output multiple messages to the console and show multiple graphs respectively.
Use context_manager.pushAlgebra(...)
and context_manager.popAlgebra()
to change the currently active Algebra 'mode'. They take the same arguments as the Algebra
factory from ganja.js
but there might be some support holes. The default is 2D PGA, equivilent to Algebra(2, 0, 1)
. The current algebra object is accessiable via context_manager.getAlgebra()
but direct access is probably not needed. This helps with the scoping and consistancy issues stated above but also helps with interoperability by ensuring each algebra produced by the factory is a singleton. This all probably comes at a slight performance cost that I am yet to care about.
Known issues:
- A lock situation occurs if you manage to save the current script to cache and it contains an infinate loop, hence the locking script will be run even on page refresh. The solution is to clear the browser cache. Hopefully this is hard to do.
Make sure to use git clone --recursive
as there are submodules.
- Nodejs runtime.
- Yarn package manager, install with
npm install -g yarn
.
- Install dependancies.
yarn install
- Start development server.
yarn start
Entry point is src/main.html
.
Attach the debugger from the 'Run and Debug' panel if in VS Code.
yarn build
Builds are output todist/
.yarn fmt
Makes sure files insrc/
meet some javascript formatting rules.