BLisp
BLisp is a statically typed Lisp like programming language which adopts effect system for no_std environments. BLisp supports higher order RPC like higher order functions of functional programming languages.
This repository provides only a library crate. Please see blisp-repl to use BLisp, and baremetalisp which is a toy OS.
Homepage is here.
Features
- Algebraic data type
- Generics
- Hindley–Milner based type inference
- Effect system to separate side effects from pure functions
- Big integer
- Supporting no_std environments
How to Use
use blisp;
If Rust compiler or linker says warning of fmod, please add fmod manually as follows.
extern "C"
Cargo.toml
[]
= "0.3.2"
Version History
0.3.3
- add hexadecimal, octal, and binary
- 0xabcDEF
- 0o777
- 0b1010
0.3.2
- add pow to compute exponent
- example: (pow 10 20)
- type of pow: (Pure (-> (Int Int) (Option Int)))
- if the exponent portion is greater or equal to 2^32, then return None
- add sqrt
- example: (sqrt 16)
- type of sqrt: (Pure (-> (Int) (Option Int)))
- if the value is less than 0, then return None
- add bitwise operations
- band, bor, bxor
0.3.1
- garbage collection is ready (mark and sweep)
Internally Defined Types and Functions
(data (Option t)
(Some t)
None)
(data (Result t e)
(Ok t)
(Err e))
(export car (x) (Pure (-> ('(t)) (Option t)))
(match x
((Cons n _) (Some n))
(_ None)))
(export cdr (x) (Pure (-> ('(t)) '(t)))
(match x
((Cons _ l) l)
(_ '())))
(export map (f x) (Pure (-> ((Pure (-> (a) b)) '(a)) '(b)))
(match x
((Cons h l) (Cons (f h) (map f l)))
(_ '())))
(export fold (f init x) (Pure (-> ((Pure (-> (a b) b)) b '(a)) b))
(match x
((Cons h l) (fold f (f h init) l))
(_ init)))