Lisp in the Rust Type System

quasigloam1 pts0 comments

GitHub - playX18/lisp-in-types: Lisp implemented inside Rust trait system · GitHub

/" data-turbo-transient="true" />

Skip to content

Search or jump to...

Search code, repositories, users, issues, pull requests...

-->

Search

Clear

Search syntax tips

Provide feedback

--><br>We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Cancel

Submit feedback

Saved searches

Use saved searches to filter your results more quickly

-->

Name

Query

To see all available qualifiers, see our documentation.

Cancel

Create saved search

Sign in

/;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up

Appearance settings

Resetting focus

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

playX18

lisp-in-types

Public

Notifications<br>You must be signed in to change notification settings

Fork

Star<br>14

main

BranchesTags

Go to file

CodeOpen more actions menu

Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit

History<br>9 Commits<br>9 Commits

examples

examples

src

src

.gitignore

.gitignore

Cargo.lock

Cargo.lock

Cargo.toml

Cargo.toml

LICENSE

LICENSE

README.md

README.md

build.rs

build.rs

View all files

Repository files navigation

lisp-in-types

Lisp in Rust trait system.

Limitations

Each symbol must be manually declared via defkey!() macro

Numbers cannot be negative

Numbers are only in range of 0..8192, you can modify build.rs to generate more natural numbers<br>but then you have to run with RUST_MIN_STACK increased.

No (defmacro ...)

No eval

I have not tested it extensively.

Features

Recursive functions

Global and lexical environments (via let bindings)

Function calls

apply properly working

call/ec

Example

Factorial:

>::GlobalOut;<br>type Fac5 = EvalValue;<br>assert_same::();

println!("(fac 5) => {:?}", ::to_rt());"> type DefFac = expr!(defun SymFac (SymN) (if (= SymN 0) 1 (* SymN (SymFac (- SymN 1)))));

type Global2 = DefFac as EvalFormGlobal1, Lex0>>::GlobalOut;<br>type Fac5 = EvalValueexpr!((SymFac 5)), Global2, Lex0>;<br>assert_same::Fac5, N120>();

println!("(fac 5) => {:?}", Fac5 as ToRtValue>::to_rt());

call/ec (delimited)

defkey!(SymCC, N10);<br>defkey!(SymK, N11);<br>type CallECExpr = expr!((call/ec SymCC (lambda (SymK) (+ 1 (SymK 5)))));<br>type CallECResult = EvalValue;<br>assert_same::();<br>println!(<br>"(call/ec cc (lambda (k) (+ 1 (k 5)))) => {:?}",<br>::to_rt()<br>);"> // call/ec demo (escape continuation, explicit tag):<br>// (call/ec cc (lambda (k) (+ 1 (k 5)))) => 5<br>defkey!(SymCC, N10);<br>defkey!(SymK, N11);<br>type CallECExpr = expr!((call/ec SymCC (lambda (SymK) (+ 1 (SymK 5)))));<br>type CallECResult = EvalValueCallECExpr, Global1, Lex0>;<br>assert_same::CallECResult, N5>();<br>println!(<br>"(call/ec cc (lambda (k) (+ 1 (k 5)))) => {:?}",<br>CallECResult as ToRtValue>::to_rt()<br>);

About

Lisp implemented inside Rust trait system

Resources

Readme

License

MIT license

Uh oh!

There was an error while loading. Please reload this page.

Activity

Stars

14<br>stars

Watchers

watching

Forks

fork

Report repository

Releases

No releases published

Packages

Uh oh!

There was an error while loading. Please reload this page.

Contributors

Uh oh!

There was an error while loading. Please reload this page.

Languages

Rust<br>100.0%

You can’t perform that action at this time.

type call lisp reload symk rust

Related Articles