Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/luohaha/dior
A kind of Lisp
https://github.com/luohaha/dior
lisp
Last synced: about 1 month ago
JSON representation
A kind of Lisp
- Host: GitHub
- URL: https://github.com/luohaha/dior
- Owner: luohaha
- Created: 2016-03-21T14:31:40.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2022-05-31T13:45:47.000Z (over 2 years ago)
- Last Synced: 2024-11-12T19:40:16.905Z (about 1 month ago)
- Topics: lisp
- Language: C
- Homepage:
- Size: 21.5 KB
- Stars: 54
- Watchers: 3
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Dior
A kind of Lisp.
## How to use
```
cd dior & make
```## Support
```scheme
if (if predicate then_value else_value)
cond (cond (predicated_1 clause_1) ... (else clause_else))
set! (set! var value)
define (define var value)
quote (quote value)
lambda (lambda (x, y, ...) body)
begin (begin exp1 exp2 exp3 ...)
set-car! (set-car! var value)
set-cdr! (set-cdr! var value)
car
cdr
list
cons
append (append (list ...) (list ...))
require (require "filename.dior")
eval (eval exp)
number?
string?
boolean?
character?
+
-
*
/
=
>=
<=
>
<
println
```## example
Fibonacci
```scheme
;;第一种递归求fibonacci的方法
(define fib-1
(lambda (n)
(cond ((= n 0) 0)
((= n 1) 1)
(else (+ (fib-1 (- n 1))
(fib-1 (- n 2)))))));;第二种, 尾递归
(define fib-iter
(lambda (a b count)
(if (= count 0)
b
(fib-iter (+ a b) a (- count 1)))))
(define fib-2
(lambda (n)
(fib-iter 1 0 n)))(fib-2 100)
```## Todo
`macro` and `gc`