chrislo / chris-lisp

My version of Peter Norvig's Scheme, but in Ruby, with tests.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

My Lisp

Introduction

Here’s my (work in progress) interpretation of Peter Norvig’s Scheme. The language of implementation is Ruby, and I’m working in a TDD-style using TestUnit.

Usage

require 'lisp'

# Define the environment. I provide a basic one.
env = Env.new
Env.add_globals(env)

# Eval some lisp code
code = '(define area (lambda (r) (* 3.141592653 (* r r))))'
lisp_eval(parse(code), env)

code = '(area 3)'
lisp_eval(parse(code), env) #=> 28.274333877

About

My version of Peter Norvig's Scheme, but in Ruby, with tests.


Languages

Language:Ruby 100.0%