quotation composition
This commit is contained in:
parent
5991d9fef3
commit
cfc45d763a
7 changed files with 87 additions and 8 deletions
18
src/object.h
18
src/object.h
|
|
@ -13,6 +13,8 @@
|
|||
enum {
|
||||
OBJ_FWD = 2,
|
||||
OBJ_QUOT,
|
||||
OBJ_COMPOSE,
|
||||
OBJ_CURRY,
|
||||
OBJ_STR,
|
||||
OBJ_USERDATA,
|
||||
};
|
||||
|
|
@ -22,6 +24,8 @@ enum {
|
|||
TYPE_NUM = 1,
|
||||
TYPE_FWD = OBJ_FWD,
|
||||
TYPE_QUOT = OBJ_QUOT,
|
||||
TYPE_COMPOSE = OBJ_COMPOSE,
|
||||
TYPE_CURRY = OBJ_CURRY,
|
||||
TYPE_STR = OBJ_STR,
|
||||
TYPE_USERDATA = OBJ_USERDATA,
|
||||
};
|
||||
|
|
@ -33,6 +37,20 @@ typedef struct Hd {
|
|||
U32 size, type;
|
||||
} Hd;
|
||||
|
||||
/** Composition */
|
||||
typedef struct Qo {
|
||||
O first, second;
|
||||
} Qo;
|
||||
|
||||
/** Curry */
|
||||
typedef struct Qc {
|
||||
O value, callable;
|
||||
} Qc; //
|
||||
|
||||
I type(O);
|
||||
static inline I callable(O o) {
|
||||
I t = type(o);
|
||||
return t == TYPE_QUOT || t == TYPE_COMPOSE || t == TYPE_CURRY;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue