ExLisp (exlisp v0.1.2)

Copy Markdown

Documentation for ExLisp.

Summary

Functions

Calls a Lisp function with the given arguments list.

Compiles a Lisp file into a BEAM module and outputs the .beam file.

Compiles a Lisp code string into a BEAM module.

Returns the default .beam output directory.

Deletes a Lisp global variable.

Evaluates a Lisp code string.

Evaluates Lisp code and formats symbols in uppercase for REPL display.

Formats a Lisp code string according to standard Common Lisp conventions.

Reads a Lisp file and returns the formatted code. If option in_place: true or write: true is given, it overwrites the file.

Gets a Lisp function as an Elixir anonymous function.

Gets the value of a Lisp global variable.

Checks if a Lisp function is defined.

Checks if a Lisp global variable is defined.

Loads a Lisp source file and evaluates each top-level expression sequentially.

Sets a Lisp global variable.

Converts data for REPL display, turning symbols/atoms to uppercase.

Functions

call(name, args)

Calls a Lisp function with the given arguments list.

Examples

iex> ExLisp.eval("(defun multiply (a b) (* a b))")
:multiply
iex> ExLisp.call(:multiply, [3, 4])
12
iex> ExLisp.call("MULTIPLY", [5, 6])
30

compile_file(path, opts \\ [])

Compiles a Lisp file into a BEAM module and outputs the .beam file.

compile_string(code, opts \\ [])

Compiles a Lisp code string into a BEAM module.

default_beam_dir()

Returns the default .beam output directory.

delete_var(name)

Deletes a Lisp global variable.

eval(code)

Evaluates a Lisp code string.

Examples

iex> ExLisp.eval("(+ 1 2)")
3

iex> ExLisp.eval("(* 2 3 4)")
24

eval_repl(code)

Evaluates Lisp code and formats symbols in uppercase for REPL display.

format(code, opts \\ [])

Formats a Lisp code string according to standard Common Lisp conventions.

Examples

iex> ExLisp.format("(+  1   2)")
"(+ 1 2)\n"

format_file(path, opts \\ [])

Reads a Lisp file and returns the formatted code. If option in_place: true or write: true is given, it overwrites the file.

get_fun(name)

Gets a Lisp function as an Elixir anonymous function.

Examples

iex> ExLisp.eval("(defun add (a b) (+ a b))")
:add
iex> add = ExLisp.get_fun(:add)
iex> add.(2, 3)
5

get_var(name)

Gets the value of a Lisp global variable.

Examples

iex> ExLisp.eval("(defparameter x 100)")
:x
iex> ExLisp.get_var(:x)
100
iex> ExLisp.get_var("X")
100

has_fun?(name)

Checks if a Lisp function is defined.

has_var?(name)

Checks if a Lisp global variable is defined.

load_file(path)

Loads a Lisp source file and evaluates each top-level expression sequentially.

set_var(name, value)

Sets a Lisp global variable.

Examples

iex> ExLisp.set_var(:y, 200)
200
iex> ExLisp.eval("y")
200

to_repl_display(val)

Converts data for REPL display, turning symbols/atoms to uppercase.