|
x-engine-c v0.2.13
The C engine for x-lang
|
Predicate and type-conversion primitives. More...
Functions | |
| static x_obj_t * | x_prim_same (x_obj_t *p_base, x_obj_t *p_args) |
| static x_obj_t * | x_prim_eq (x_obj_t *p_base, x_obj_t *p_args) |
| static x_obj_t * | x_prim_num_eq (x_obj_t *p_base, x_obj_t *p_args) |
| static x_obj_t * | x_prim_lt (x_obj_t *p_base, x_obj_t *p_args) |
| static x_obj_t * | x_prim_char_to_integer (x_obj_t *p_base, x_obj_t *p_args) |
| static x_obj_t * | x_prim_integer_to_char (x_obj_t *p_base, x_obj_t *p_args) |
| x_obj_t * | x_prim_pred_register (x_obj_t *p_base, x_obj_t *p_args) |
Predicate and type-conversion primitives.
Convert a character to its integer code point. x-lang: (char->integer c)
| p_base | Interpreter base context. |
| p_args | Unevaluated argument list: (char->integer c). |
Value equality test (also bound as =). x-lang: (eq? a b) / (= a b)
| p_base | Interpreter base context. |
| p_args | Unevaluated argument list: (eq? a b). |
a and b are equal by value, #f otherwise. a==b fast path covers nil, booleans, and interned symbols – and, being checked before any dereference, keeps (eq? x ()) from reading a nil value slot. Use same? for strict object identity. Convert an integer code point to a character. x-lang: (integer->char n)
| p_base | Interpreter base context. |
| p_args | Unevaluated argument list: (integer->char n). |
Integer less-than comparison, with typed-operand dispatch. x-lang: (< a b)
| p_base | Interpreter base context. |
| p_args | Unevaluated argument list: (< a b). |
a is numerically less than b, #f otherwise. Numeric equality with typed-operand dispatch (bound as = only). x-lang: (= a b)
| p_base | Interpreter base context. |
| p_args | Unevaluated argument list: (= a b). |
eq? – identity semantics must never dispatch through a type's ops (eq? on two floats is value-word identity, not f=). Evaluates its own args, so the fallthrough repeats x_prim_eq's comparison inline rather than delegating (delegation would re-evaluate the args). Register predicate and type-conversion primitives.
Binds: same?, eq?, =, <, char->integer, integer->char.
| p_base | Interpreter base context. |
| p_args | Unused. |
p_base. Object identity test (pointer equality). x-lang: (same? a b)
| p_base | Interpreter base context. |
| p_args | Unevaluated argument list: (same? a b). |
a and b are the same object (pointer), #f otherwise.