Skip to content

A web calculator offering functionality such as used-defined variables and functions

Notifications You must be signed in to change notification settings

nikklassen/Horus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

87 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Horus

![Gitter](https://badges.gitter.im/Join Chat.svg)

Horus is a simple mathematical programming language/scientific calculator. The main advantage over a traditional scientific calculator is that functions and variables are supported, and tied to the user's session. A working instance can be found here.

Variables

There are two different types of variables, although they can be generalized as a variable is a value that is always equal to the right hand side of its definition. A traditional variable is defined as follows

a = 2 + 3

A bound variable is a variable whose value depends on the current value of another variable. It is defined as such

b := a * 4

Currently b would be 20, but if a changed, so would b. Recursive definitions are not allowed.

Functions

Functions work as usual, with local parameters shadowing global variables. For example, in

a = 4
f(x) = x + a

the function f will add the value of its parameter x to the current value of the global variable a. Functions can call other functions, but scopes do not propogate in any way. Many standard scientific functions are built in.

Installation

Horus requires GHC >= 7.8.*, and node.js for tests. Here are Ubuntu instructions for installing GHC if you need a place to start. Package installation for Horus can be done using cabal and npm. For example

# Working directory is the clone of Horus
cabal sandbox init
cabal install --only-dependencies

make

If you don't want to use a cabal sandbox you will have to remove the applicable GHC args in the Makefile.

To run the tests do

npm install
make tests

Ensure that the local node_modules is in your path, or install the protractor and mocha modules globally.

Hosting

Static files are all in resources, so these can be served with your method of choice. The default port for the server executable is 3000, and needs to be served on the same port as the static files, under the path /api. A sample nginx config is

location ^~ /Horus {
	alias $CHECKOUT_DIR/Horus/resources/html;
	
	location ~* \.(css|js)$ {
		root $CHECKOUT_DIR/Horus/resources/;
	    rewrite ^/Horus/(.*)$ /$1 break;
	}
	
	location ~ api/ {
	    rewrite ^/Horus/api/(.*) /$1 break;
	    proxy_pass http://localhost:3000;
	}
}

where $CHECKOUT_DIR is specific to you.

About

A web calculator offering functionality such as used-defined variables and functions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published