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:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
define append( x, y ) =>> 
    if x.isPair then 
        newPair( x.head, x.tail @append y ) 
    else 
        y 
    endif 
enddefine; 

define rev( x ) =>>
    if x.isPair then 
        x.tail.rev @append [ x.head ] 
    else  
        [] 
    endif 
enddefine; 

define upto( n ) =>> 
    [ for i from 1 to n do i endfor ] 
enddefine; 

10.upto.rev;

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)