Skip to content
A small Lisp implementation in Go
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
README.md
env.go
go.mod
go.sum
main.go

README.md

mini-lisp

A small Lisp implementation in Go.

Examples

;; Factorial
(define fact (lambda (n) (if (<= n 1) 1 (* n (fact (- n 1))))))
(fact 5)
; 120

;; sum2 demonstrating tail recursion optimization
(define sum2 (lambda (n acc) (if (= n 0) acc (sum2 (- n 1) (+ n acc)))))
(sum2 1000 0)
; 500500

;; catch! examples
(catch! (lambda (throw) (+ 5 (* 10 (catch! (lambda (escape) (* 100 (throw 3))))))))
; 3
(catch! (lambda (throw) (+ 5 (* 10 (catch! (lambda (escape) (* 100 (escape 3))))))))
; 35

Features

  • REPL
  • Lambdas
  • Tail recursion optimization

References

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.