kanales / tin

Lisp implementation in Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tin

Empty tin can2009-01-19

Tin is a lisp implemented in rust. 🚨 Warning 🚨 Currently tin is not close to being ready for running in production. Expect bugs and a subpar UX (for now).

Installation

Currently it can only be run from source. Assuming you have rlwrap installed, build the rust project,

$ cargo build --release

and execute it by running ./tin.

Features

  • Hash maps
    • standard hash map functions
  • Vectors
    • standard hash vector functions
  • Standard "functional programming functions"
  • macros
  • variadic arguments

Differences with Scheme

Although Tin is mainly based of the Scheme dialect, it does present some differences with scheme.

Vectors

Instead of using the #( ... ) syntax for vectors, the [ ... ] is used in Tin. This is inspired in Clojure and other (non lisp) programming languages like Python.

Hash maps

Tin provides a hash map datatype that can be created by using the make-hash function on a sequence of key-value pairs, or by using the hash construct { ... }. For example:

(define my-map { 'a 1 'b 2 })

Index by call

In Tin the notion of (hash)map and vector is interpreted as a mapping from the index space to the value space. Therefore, both hash and vector values can be evaluated on its indices:

> ({ 'a 1 'b 2 } 'a)
1
> (['a 'b 'c] 2) ; vectors are 0-indexed *this might change in the future*
b 

Macros

Macros in Tin are defined using the defmacro function:

(defmacro defn (name args body) 
    `(define ,name (lambda ,args ,body)))
(defn plus-1 (x) (+ 1 x))

About

Lisp implementation in Rust

License:GNU General Public License v3.0


Languages

Language:Rust 99.9%Language:Shell 0.1%