## Description

A scheme like programming language and interpreter

## Package Information

Version | 0.1.8 (2016-Nov-20) |

Repository | https://github.com/alphaKAI/chickenclisp |

License | MIT |

Copyright | Copyright (C) 2016, Akihiro Shoji |

Authors | Akihiro Shoji |

Registered by | alphaKAI |

Dependencies | none |

## Installation

To use this package, put the following dependency into your project's dependencies section:

## Readme

## ChickenClisp

A minimal implementation of Orelang in D.
This program was translated from Orelang_TS
ChickenClisp means an interpreter of extended Orelang and the language itself.
ChickenClisp is just like a Scheme like Lisp.

## What's Orelang?

Orelang is simple and minimal programming language declared at the articleプログラミング言語を作る。１時間で

## Features

This is an implementation of Orelang and provides more functions

- if/cond expression
- compare functions: >,>=,<,<=
- logics : and(&&), or(||), not(!)
- function definition
- Function/Operator is first-class object
- Lambda Expression (lambda keyword)
- Closure
- List support(and utilities like car, cdr)

This language aims an original scheme like lisp.

## Specification of Orelang

This is not an original specification original is can be found at the article.

### Grammer

Orelang provide only one grammer.

`Expr := (operator args1 args2...) <- this is CallOperator`

`Expr := value <- this is ImmediateValue`

This looks like lisp.

## Sample codes

Some sample code can be found at samples/ and sample.d is sample code runner, you can see sample codes have only to run it, but I'll show you some sample codes of ChickenClisp here.

### Sum 1 to 10

#### Procedural impl:

```
(step
(set i 0)
(set sum 0)
(while (<= i 10)
(step
(set sum (+ i sum))
(set i (+ i 1))))
(println "sum 1 to 10 : " sum))
```

#### Functional(use high order function)

```
; seq(n) creates a sequence of '(0 1 2 ... n)
(println (fold + 0 (seq 11)))
```

### Square 1 to 10 with high order function - map(/foreach)

```
(println (map (lambda (x) (* x x)) (cdr (seq 11))))
```

You can define an function to square:

```
(def square (x) (* x x))
(println (map square (cdr (seq 11))))
```

As you can see, Function is a first-class Object in ChickenClisp!.

### Fibonacci

```
(def fib (n)
(step
(if (= n 0) 0
(if (= n 1) 1
(+ (fib (- n 1)) (fib (- n 2)))))))
```

or:

```
(def fib (n)
(step
(def fib-iter (n a b)
(if (= n 0)
a
(fib-iter (- n 1) b (+ a b))))
(fib-iter n 0 1)))
```

then:

```
(println (map fib (seq 10)))
```

### More sample codes

More sample codes are wrote in `sample.d`

.

## Installation

### Requirements

- dmd(v2.070 or later)
- dub(1.0.0 or later)

### Commands

```
$ git clone https://github.com/alphaKAI/ChickenClisp
$ cd ChickenClisp
$ dub build
$ ./chickenclisp
```

## License

ChickenClisp is released under the MIT License.
Please see `LICENSE`

file for details.

Copyright (C) 2016 Akihiro Shoji

## Available versions

*0.1.8*0.1.7 0.1.6 0.1.5 0.1.4 0.1.3 0.1.2 0.1.1 0.1.0 ~master