Get Started with Ginger

Download, compile and install Ginger

$ git clone git@github.com:Spicery/ginger.git
$ cd ginger
$ APPGINGER=`pwd`
$ ./configure
$ sudo make && make install

Install RudeCGI library

$ cd /tmp
$ wget http://rudeserver.com/cgiparser/download/rudecgi-5.0.0.tar.gz
$ tar zxf rudecgi-5.0.0.tar.gz
$ pushd rudecgi-5.0.0; ./configure; sudo make && make install; popd

Install optional extras

$ sudo apt-get install guile-1.8 guile-1.8-dev guile-1.8-doc doxygen

Run a Ginger program

$ cd examples
$ common2gnx hello.cmn

A slightly more extensive worked example

Given that the content of “upto.common” is:

 1define append( x, y ) =>> 
 2    if x.isPair then 
 3        newPair( x.head, x.tail @append y ) 
 4    else 
 5        y 
 6    endif 
 7enddefine; 
 8
 9define rev( x ) =>>
10    if x.isPair then 
11        x.tail.rev @append [ x.head ] 
12    else  
13        [] 
14    endif 
15enddefine; 
16
17define upto( n ) =>> 
18    [ for i from 1 to n do i endfor ] 
19enddefine; 
20
2110.upto.rev;
22

Then piping the Ginger Common syntax source through common2gnx and then appginger:

$ cat upto.common | common2gnx | appginger

produces the following console output:

Ginger: 0.7, Copyright (c) 2010  Stephen Leach
  +----------------------------------------------------------------------+
  | This program comes with ABSOLUTELY NO WARRANTY. It is free software, |
  | and you are welcome to redistribute it under certain conditions.     |
  | Use option --help=license for details.                               |
  +----------------------------------------------------------------------+
There are 0 results (0s)

There are 0 results (0s)

There are 0 results (0s)

There is 1 result   (0s)
1.  [10,9,8,7,6,5,4,3,2,1]

Try increasing the 10.upto.rev to 1000.upto.rev and feel the breeze:

Ginger: 0.7, Copyright (c) 2010  Stephen Leach
  +----------------------------------------------------------------------+
  | This program comes with ABSOLUTELY NO WARRANTY. It is free software, |
  | and you are welcome to redistribute it under certain conditions.     |
  | Use option --help=license for details.                               |
  +----------------------------------------------------------------------+
There are 0 results (0s)

There are 0 results (0s)

There are 0 results (0s)

There is 1 result   (0.41s)
1.  [1000,999, ... 1]

(to avoid tedium, the output has been elided)