Skip to content

chrisbutcher/goscheme

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Experimental Scheme Interpreter and REPL in Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published