defmacro added, doc improvements
This commit is contained in:
32
ml.h
32
ml.h
@@ -102,7 +102,21 @@ typedef MlValue (*Builtin)(std::vector<MlValue>, MlEnvironment &);
|
||||
class MlPerfMon;
|
||||
|
||||
class MlValue {
|
||||
|
||||
public:
|
||||
enum Type {
|
||||
QUOTE,
|
||||
ATOM,
|
||||
INT,
|
||||
FLOAT,
|
||||
LIST,
|
||||
STRING,
|
||||
LAMBDA,
|
||||
MACRO,
|
||||
BUILTIN,
|
||||
NIL,
|
||||
TRUE
|
||||
} type;
|
||||
|
||||
public:
|
||||
MlValue(); // Constructs a nil value
|
||||
MlValue(long i);
|
||||
@@ -116,7 +130,7 @@ public:
|
||||
static MlValue string(const std::string &s);
|
||||
static MlValue nil();
|
||||
|
||||
MlValue(const std::vector<MlValue> ¶ms, MlValue ret, MlEnvironment const &env); // Construct a lambda function
|
||||
MlValue(const std::vector<MlValue> ¶ms, MlValue ret, MlEnvironment const &env, const Type ftype); // Construct a lambda or macro function
|
||||
MlValue(const std::string &name, Builtin b); // Construct a builtin function
|
||||
|
||||
std::vector<std::string> get_used_atoms();
|
||||
@@ -128,6 +142,7 @@ public:
|
||||
MlValue eval(MlEnvironment &env);
|
||||
|
||||
bool is_builtin() const;
|
||||
bool is_macro() const;
|
||||
bool is_number() const;
|
||||
bool is_string() const;
|
||||
bool is_list() const;
|
||||
@@ -175,19 +190,6 @@ public:
|
||||
friend std::ostream &operator<<(std::ostream &os, MlValue const &v);
|
||||
|
||||
private:
|
||||
enum {
|
||||
QUOTE,
|
||||
ATOM,
|
||||
INT,
|
||||
FLOAT,
|
||||
LIST,
|
||||
STRING,
|
||||
LAMBDA,
|
||||
BUILTIN,
|
||||
NIL,
|
||||
TRUE
|
||||
} type;
|
||||
|
||||
union {
|
||||
long i;
|
||||
double f;
|
||||
|
||||
Reference in New Issue
Block a user