Crates.io | callisp |
lib.rs | callisp |
version | 0.2.1 |
source | src |
created_at | 2023-01-21 18:12:01.974572 |
updated_at | 2023-01-24 14:27:39.074921 |
description | A lisp interpreter that can be used with WASM. |
homepage | https://callumirving.pages.dev/projects/callisp/ |
repository | https://github.com/Callum-Irving/callisp |
max_upload_size | |
id | 764518 |
size | 55,547 |
A Lisp interpreter designed to be run in the browser using WASM.
You can perform simple numerical operations using +, -, *, and /:
(+ 1 2) => 3
(/ 5 2) => 2.5
(- 2) => -2
(/ 5) => 0.2
You can define constants using def
:
(def x 3) => 3
x => 3
You can create functions using lambda
:
(lambda (x) (+ x 1)) => <function>
(def add1 (lambda (x) (+ x 1))) => <unspecified>
(add1 3) => 4
(def name value)
: creates a binding of name to value in current environment(lambda (bindings) expr)
or (λ (bindings) expr)
: creates a function(if cond do else)
: evaluate do expr if cond is true, otherwise evaluate else expr+
,-
,*
,/
: simple arithmetic operatorsexit
: exits with code 0 or code provided by argumenteval
: evaluate the expression passed as an argumentuse
: evaluate all expressions contained in a file in the current environmentputstr
: print a string to stdoutreadline
: read a line from stdinequal?
: check if any amount of values are equal>
, >=
, <
, <=
: number comparison operatorslist
: creates a list out of arguments givenlist?
: returns true if argument is a list, otherwise returns falseempty?
: returns true if argument is a list of length 0, otherwise returns falsecount
: returns the length of the argument if the argument is a listGoals in order of priority: