Builtins for doing type heierachy stuff. More...
Go to the source code of this file.
Functions | |
static long | c_children () |
c_children More... | |
static long | c_parents () |
c_parents More... | |
static long | c_smallest () |
c_smallest More... | |
int | isSubTypeValue (ptr_psi_term arg1, ptr_psi_term arg2) |
isSubTypeValue More... | |
static long | isa (ptr_psi_term arg1, ptr_psi_term arg2) |
isa More... | |
static long | isa_select (ptr_psi_term arg1, ptr_psi_term arg2, long sel) |
isa_select More... | |
static long | c_isa_main (long sel) |
c_isa_main More... | |
static long | c_isa_le () |
c_isa_le More... | |
static long | c_isa_lt () |
c_isa_lt More... | |
static long | c_isa_ge () |
c_isa_ge More... | |
static long | c_isa_gt () |
c_isa_gt More... | |
static long | c_isa_eq () |
c_isa_eq More... | |
static long | c_isa_nle () |
c_isa_nle More... | |
static long | c_isa_nlt () |
c_isa_nlt More... | |
static long | c_isa_nge () |
c_isa_nge More... | |
static long | c_isa_ngt () |
c_isa_ngt More... | |
static long | c_isa_neq () |
c_isa_neq More... | |
static long | c_isa_cmp () |
c_isa_cmp More... | |
static long | c_isa_ncmp () |
c_isa_ncmp More... | |
static long | c_is_function () |
c_is_function More... | |
static long | c_is_persistent () |
c_is_persistent More... | |
static long | c_is_predicate () |
c_is_predicate More... | |
static long | c_is_sort () |
c_is_sort More... | |
static long | c_is_value () |
c_is_value More... | |
static long | c_is_number () |
static long c_is_number More... | |
long | c_isa_subsort () |
long c_isa_subsort More... | |
long | isValue (ptr_psi_term p) |
isValue(p) More... | |
long | c_glb () |
long c_glb More... | |
long | c_lub () |
long c_lub More... | |
void | insert_type_builtins () |
void insert_type_builtins More... | |
Builtins for doing type heierachy stuff.
Definition in file bi_type.c.
|
static |
c_children
Return a list of roots of the children types of T (except bottom).
Definition at line 30 of file bi_type.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, wl_definition::children, collect_symbols(), curry(), deref, deref_args, deref_ptr, get_two_args(), greatest_sel, hidden_type(), wl_int_list::next, NULL, push_goal(), real, resid_aim, set_1, stack_cons(), stack_nil(), stack_psi_term(), top, TRUE, wl_psi_term::type, unify, wl_int_list::value_1, and wl_psi_term::value_3.
long c_glb | ( | ) |
long c_glb
greatest lower bound (djd)
C_GLB(A,B) Return glb(A,B). Continued calls will return each following type in the disjunction of the glb of A,B.
Definition at line 709 of file bi_type.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), decode(), deref, deref_args, deref_ptr, Errorline(), FALSE, get_two_args(), glb(), isSubTypeValue(), isValue(), makePsiTerm(), wl_int_list::next, NULL, push_choice_point(), push_goal(), resid_aim, set_1_2, TRUE, wl_psi_term::type, type_disj, unify, wl_int_list::value_1, and wl_psi_term::value_3.
|
static |
c_is_function
Succeed iff argument is a function (built-in or user-defined).
Definition at line 500 of file bi_type.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, function_it, get_one_arg(), set_1, TRUE, wl_psi_term::type, wl_definition::type_def, and unify_bool_result().
|
static |
static long c_is_number
Return true iff argument is an actual number.
Definition at line 636 of file bi_type.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, get_two_args(), NULL, real, set_1, sub_type(), TRUE, wl_psi_term::type, unify_bool_result(), and wl_psi_term::value_3.
|
static |
c_is_persistent
Succeed iff argument is a quoted persistent or on the heap.
Definition at line 526 of file bi_type.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, get_one_arg(), global_it, wl_definition::global_value, heap_pointer, set_1, TRUE, wl_psi_term::type, wl_definition::type_def, and unify_bool_result().
|
static |
c_is_predicate
Succeed iff argument is a predicate (built-in or user-defined).
Definition at line 556 of file bi_type.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, get_one_arg(), predicate_it, set_1, TRUE, wl_psi_term::type, wl_definition::type_def, and unify_bool_result().
|
static |
c_is_sort
Succeed iff argument is a sort (built-in or user-defined).
Definition at line 582 of file bi_type.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, get_one_arg(), set_1, TRUE, wl_psi_term::type, wl_definition::type_def, type_it, and unify_bool_result().
|
static |
c_is_value
Return true iff argument has a value, i.e. if it is implemented in a quirky way in Wild_Life. This is true for integers, reals, strings (which are potentially infinite sets of objects), and list objects.
Definition at line 610 of file bi_type.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, get_two_args(), NULL, set_1, TRUE, unify_bool_result(), and wl_psi_term::value_3.
|
static |
c_isa_cmp
Definition at line 480 of file bi_type.c.
References c_isa_main(), and isa_cmp_sel.
|
static |
c_isa_eq
Type t1 equals t2 in the hierarchy, i.e. t1 is equal to t2. This boolean function requires two arguments and never residuates. It will curry if insufficient arguments are given. It works correctly on the 'value' types, i.e. on integers, reals, strings, and lists. For lists, it looks only at the top level, i.e. whether the object is nil or a cons cell.
Definition at line 391 of file bi_type.c.
References c_isa_main(), and isa_eq_sel.
|
static |
c_isa_ge
Type t2 isa t1 in the hierarchy, i.e. t2 is less than or equal to t1. This boolean function requires two arguments and never residuates. It will curry if insufficient arguments are given. It works correctly on the 'value' types, i.e. on integers, reals, strings, and lists. For lists, it looks only at the top level, i.e. whether the object is nil or a cons cell.
Definition at line 359 of file bi_type.c.
References c_isa_main(), and isa_ge_sel.
|
static |
c_isa_gt
Type t2 is lt t1 in the hierarchy, i.e. t2 is less than to t1. This boolean function requires two arguments and never residuates. It will curry if insufficient arguments are given. It works correctly on the 'value' types, i.e. on integers, reals, strings, and lists. For lists, it looks only at the top level, i.e. whether the object is nil or a cons cell.
Definition at line 375 of file bi_type.c.
References c_isa_main(), and isa_gt_sel.
|
static |
c_isa_le
Type t1 isa t2 in the hierarchy, i.e. t1 is less than or equal to t2. This boolean function requires two arguments and never residuates. It will curry if insufficient arguments are given. It works correctly on the 'value' types, i.e. on integers, reals, strings, and lists. For lists, it looks only at the top level, i.e. whether the object is nil or a cons cell.
Definition at line 327 of file bi_type.c.
References c_isa_main(), and isa_le_sel.
|
static |
c_isa_lt
Type t1 is lt t2 in the hierarchy, i.e. t1 is less than t2. This boolean function requires two arguments and never residuates. It will curry if insufficient arguments are given. It works correctly on the 'value' types, i.e. on integers, reals, strings, and lists. For lists, it looks only at the top level, i.e. whether the object is nil or a cons cell.
Definition at line 343 of file bi_type.c.
References c_isa_main(), and isa_lt_sel.
|
static |
c_isa_main
sel | - long sel |
Main routine to handle all the isa built-in functions.
Definition at line 295 of file bi_type.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, get_two_args(), isa_select(), set_1_2, TRUE, and unify_bool_result().
|
static |
c_isa_ncmp
Definition at line 489 of file bi_type.c.
References c_isa_main(), and isa_ncmp_sel.
|
static |
c_isa_neq
Type t1 is not eq t2 in the hierarchy, i.e. t1 is not equal to t2. This boolean function requires two arguments and never residuates. It will curry if insufficient arguments are given. It works correctly on the 'value' types, i.e. on integers, reals, strings, and lists. For lists, it looks only at the top level, i.e. whether the object is nil or a cons cell.
Definition at line 471 of file bi_type.c.
References c_isa_main(), and isa_neq_sel.
|
static |
c_isa_nge
Type t2 is not lt t1 in the hierarchy, i.e. t2 is not less than or equal to t1. This boolean function requires two arguments and never residuates. It will curry if insufficient arguments are given. It works correctly on the 'value' types, i.e. on integers, reals, strings, and lists. For lists, it looks only at the top level, i.e. whether the object is nil or a cons cell.
Definition at line 439 of file bi_type.c.
References c_isa_main(), and isa_nge_sel.
|
static |
c_isa_ngt
Type t2 is not t1 in the hierarchy, i.e. t2 is not less than t1. This boolean function requires two arguments and never residuates. It will curry if insufficient arguments are given. It works correctly on the 'value' types, i.e. on integers, reals, strings, and lists. For lists, it looks only at the top level, i.e. whether the object is nil or a cons cell.
Definition at line 455 of file bi_type.c.
References c_isa_main(), and isa_ngt_sel.
|
static |
c_isa_nle
Type t1 is not a t2 in the hierarchy, i.e. t1 is not less than or equal to t2. This boolean function requires two arguments and never residuates. It will curry if insufficient arguments are given. It works correctly on the 'value' types, i.e. on integers, reals, strings, and lists. For lists, it looks only at the top level, i.e. whether the object is nil or a cons cell.
Definition at line 407 of file bi_type.c.
References c_isa_main(), and isa_nle_sel.
|
static |
c_isa_nlt
Type t1 is not lt t2 in the hierarchy, i.e. t1 is not less than to t2. This boolean function requires two arguments and never residuates. It will curry if insufficient arguments are given. It works correctly on the 'value' types, i.e. on integers, reals, strings, and lists. For lists, it looks only at the top level, i.e. whether the object is nil or a cons cell.
Definition at line 423 of file bi_type.c.
References c_isa_main(), and isa_nlt_sel.
long c_isa_subsort | ( | ) |
long c_isa_subsort
C_ISA_SUBSORT(A,B) if A is a subsort of B => succeed and residuate on B else => fail
Definition at line 664 of file bi_type.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, deref, deref_args, deref_ptr, FALSE, get_two_args(), isa(), reportAndAbort(), residuate(), set_1_2, and TRUE.
long c_lub | ( | ) |
long c_lub
least upper bound (djd) C_LUB(A,B) Return lub(A,B). Continued calls will return each following type in the disjunction of the lub of A,B.
Definition at line 773 of file bi_type.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, get_two_args(), lub(), makePsiTerm(), wl_int_list::next, NULL, push_choice_point(), push_goal(), resid_aim, set_1_2, TRUE, type_disj, unify, and wl_int_list::value_1.
|
static |
c_parents
Return a list of roots of the parent types of T.
Definition at line 96 of file bi_type.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, get_two_args(), hidden_type(), integer, wl_int_list::next, NULL, wl_definition::parents, push_goal(), quoted_string, real, resid_aim, set_1, stack_cons(), stack_nil(), stack_psi_term(), top, TRUE, wl_psi_term::type, unify, wl_int_list::value_1, and wl_psi_term::value_3.
|
static |
c_smallest
Return the parents of bottom. This function has no arguments.
Definition at line 159 of file bi_type.c.
References wl_goal::aaaa_1, aim, wl_goal::bbbb_1, collect_symbols(), deref_args, least_sel, NULL, push_goal(), set_empty, TRUE, and unify.
void insert_type_builtins | ( | ) |
void insert_type_builtins
Definition at line 817 of file bi_type.c.
References bi_module, c_children(), c_glb(), c_is_function(), c_is_number(), c_is_persistent(), c_is_predicate(), c_is_sort(), c_is_value(), c_isa_cmp(), c_isa_eq(), c_isa_ge(), c_isa_gt(), c_isa_le(), c_isa_lt(), c_isa_ncmp(), c_isa_neq(), c_isa_nge(), c_isa_ngt(), c_isa_nle(), c_isa_nlt(), c_isa_subsort(), c_lub(), c_parents(), c_smallest(), function_it, new_built_in(), predicate_it, and syntax_module.
|
static |
isa
arg1 | - ptr_psi_term arg1 |
arg2 | - ptr_psi_term arg2 |
Boolean utility function that implements isa
Definition at line 219 of file bi_type.c.
References cut, integer, isSubTypeValue(), matches(), real, TRUE, wl_psi_term::type, and wl_psi_term::value_3.
|
static |
isa_select
arg1 | - ptr_psi_term arg1 |
arg2 | - ptr_psi_term arg2 |
sel | - long sel - one of several values defined in def_const.h |
Utility that selects one of several isa functions
Definition at line 253 of file bi_type.c.
References isa(), isa_cmp_sel, isa_eq_sel, isa_ge_sel, isa_gt_sel, isa_le_sel, isa_lt_sel, isa_ncmp_sel, isa_neq_sel, isa_nge_sel, isa_ngt_sel, isa_nle_sel, and isa_nlt_sel.
int isSubTypeValue | ( | ptr_psi_term | arg1, |
ptr_psi_term | arg2 | ||
) |
isSubTypeValue
arg1 | - ptr_psi_term arg1 |
arg2 | - ptr_psi_term arg2 |
Definition at line 180 of file bi_type.c.
References FALSE, integer, quoted_string, REAL, real, TRUE, wl_psi_term::type, and wl_psi_term::value_3.
long isValue | ( | ptr_psi_term | p | ) |
isValue(p)
p | - ptr_psi_term p |
Definition at line 694 of file bi_type.c.
References NULL, and wl_psi_term::value_3.