goscheme

command module
v0.0.0-...-d7a3694 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2015 License: GPL-3.0 Imports: 11 Imported by: 0

README

goscheme

An experimental Scheme interpreter and REPL in Go.

GoDoc

Running

cd goscheme
go install
goscheme # for REPL
goscheme sample.scm # to run a Scheme script

Examples

> (+ 3 4)
 => 7

> (car (cdr (cdr (list 1 2 3))))
 => 3

> (begin 
    (define square (lambda (x) (* x x)))
    (define sum-of-squares (lambda (a b) (+ (square a) (square b))))
    (sum-of-squares 3 4))
 => 25

> (define y 12)
 => 12
> (set! y 41)
 => 41
> ((lambda (x) (+ x y)) 1)
 => 42

> (((lambda (x) (x x))
    (lambda (fact-gen)
      (lambda (n)
        (if (= 1 n) 1 (* n ((fact-gen fact-gen) (- n 1))))
      )
    )
  ) 100)
 => 9.33262154439441e+157

> (begin
    (define lessthanten (lambda (x) (if (< x 10) #t #f)))
    (lessthanten 9))
 => #t

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL