Archived
1
0
Fork 0
This repository has been archived on 2023-11-10. You can view files and clone it, but cannot push or open issues or pull requests.
lispy/lval/expressions.h

41 lines
1.3 KiB
C

#ifndef LVAL_EXPRESSIONS
#define LVAL_EXPRESSIONS
#include "base.h"
// Constructors for the SEXPR and QEXPR data type
lval* lval_sexpr(void);
lval* lval_qexpr(void);
/*
--------------------------------------------------------
Add the functionality to be able to add or remove
expressions from the group
*/
lval* lval_add(lval* v, lval* x);
// Remove an expression from the group and return it
lval* lval_pop(lval* v, int i);
// Remove an expression from the group and delete the rest the group
lval* lval_take(lval* v, int i);
/* ----------------------------------------------------*/
// Adds the ability to evalutate each expression in the group
lval* lval_eval_sexpr(lval* v);
/*
QEXPR Operations
Head: Takes a Q-Expression and returns a Q-Expression with only of the first element
Tail: Takes a Q-Expression and returns a Q-Expression with the first element removed
List: Takes one or more arguments and returns a new Q-Expression containing the arguments
Eval: Takes a Q-Expression and evaluates it as if it were a S-Expression
Join: join Takes one or more Q-Expressions and returns a Q-Expression of them conjoined together
*/
lval* builtin_head(lval* a);
lval* builtin_tail(lval* a);
lval* builtin_list(lval* a);
lval* builtin_eval(lval* a);
lval* lval_join(lval* x, lval* y);
lval* builtin_join(lval* a);
#endif