How to install Egison (Packages)
Linux users can install Egison with yum
or dpkg
by the following simple commands!
$ sudo yum install https://git.io/egison.x86_64.rpm https://git.io/egison-tutorial.x86_64.rpm
$ wget https://git.io/egison.x86_64.deb https://git.io/egison-tutorial.x86_64.deb
$ sudo dpkg -i ./egison*.deb
How to install Egison (Haskell Platform)
1. Install Haskell Platform
To install Egison, you need to install Haskell Platform.
This is because Egison is implemented in Haskell and distributed as a Hackage package.
If you are using Linux that has apt-get
command, execute the following commands.
% sudo apt-get update
% sudo apt-get install haskell-platform libncurses5-dev
2. Install Egison via Hackage
After you installed Haskell Platform, perform the following commands in the terminal.
% cabal update
% cabal install egison egison-tutorial
...
Installing executable(s) in /home/xxx/.cabal/bin
Registering egison-X.X.X...
3. Set PATH for your shell
If successfully installed, there will be an output where the binary file is generated as above.
Please add new path to $PATH
variable of your shell, to make your shell be able to find egison
command.
For example, if you are using bash, you will execute commands as follows.
% echo "PATH=\$PATH:/home/xxx/.cabal/bin" >> ~/.bashrc
% source ~/.bashrc
How to start Egison
Now, you can run Egison interpreter with the egison
command.
Type Control-D to terminate the interpreter.
% egison
Egison Version X.X.X (C) 2011-20XX Satoshi Egi
http://www.egison.org
Welcome to Egison Interpreter!
> ^D
Leaving Egison Interpreter.
You can run the egison-tutorial
command, too.
Type Control-D to terminate the tutorial.
This is a tutorial command for beginner.
Please try it first!
% egison-tutorial
Egison Tutorial for Version X.X.X (C) 2013-20XX Satoshi Egi
http://www.egison.org
Welcome to Egison Tutorial!
==============================
List of sections in the tutorial
1: Calculate numbers
2: Basics of functional programming
3: Define your own functions
4: Basic of pattern-matching
5: Pattern-matching against infinite collections
6: Writing scripts in Egison
==============================
Choose a section to learn.
(1-6): 5
====================
We can write a pattern-matching against infinite lists even if that has infinite results.
Note that Egison really enumerate all pairs of two natural numbers in the following example.
Examples:
(take 10 (match-all nats (set integer) [> [m n]]))
====================
>