Sha256: 42d8d5079be86974735e6a79c993ad08277b2089e90258682a08067010e3b0ae

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

# Läsp

A very simple Lisp implementation in Ruby. Run `lasp-repl` to play around with
it, or `lasp path/to/program.lasp` to execute a Läsp file.

## The language

### Examples

```lisp
(+ 1 2 3)
; => 6

(def x 5)
x
; => 6

(def inc (fn (x) (+ x 1)))
(inc 5)
; => 6
```

### Data types

Supports these datatypes (implemented as their Ruby counterparts)

- integer
- float
- boolean
- nil
- string

### Comments

Comments start with a `;` and end at the end of a line

```lisp
; This is a comment
(+ 1 2) ; This is also a comment
```

### Functions in corelib

Implemented as Ruby lambdas.

- `+`
- `-`
- `*`
- `/`
- `<`
- `>`
- `=`
- `head`
- `tail`
- `cons`
- `not`
- `println`

### Special forms

Implemented as special cases while evaluating.

- `def`
- `fn`
- `do`
- `if`

### Functions in stdlib

Implemented in Läsp itself.

- `first` (alias of `head`)
- `rest` (alias of `tail`)
- `inc`
- `dec`
- `empty?`
- `mod`
- `complement`
- `even?`
- `odd?`
- `len`
- `nth`
- `last`
- `reverse`
- `map`
- `reduce`
- `filter`
- `sum`
- `take`
- `drop`
- `range`
- `max`
- `min`

## Developing

Run the tests with `rspec`.

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lasp-0.1.1 README.md
lasp-0.1.0 README.md