43 return cell_a->
tag.value == cell_b->
tag.value;
52 return nilp(
string ) ||
66 long double fa = fabsl( a );
67 long double fb = fabsl( b );
69 long double diff = fabsl( fa - fb );
71 long double av = ( fa > fb ) ? ( fa - diff ) : ( fb - diff );
73 long double tolerance = av * 0.000000001;
75 bool result = ( fabsl( a - b ) < tolerance );
106 L
"\nequality is not yet implemented for bignums compared to reals." );
132 switch ( cell_b->
tag.value ) {
167 switch ( cell_b->
tag.value ) {
200 bool result =
eq( a, b );
211 switch ( cell_a->
tag.value ) {
219 switch ( cell_b->
tag.value ) {
346 switch ( cell_a->
tag.value ) {
368 if ( cell_a->
payload.string.hash ==
369 cell_b->
payload.string.hash ) {
372 uint32_t
tag = cell_a->
tag.value;
375 memset( a_buff, 0,
sizeof( a_buff ) );
376 memset( b_buff, 0,
sizeof( b_buff ) );
380 && !
nilp( b ); i++ ) {
381 a_buff[i] = cell_a->
payload.string.character;
385 b_buff[i] = cell_b->
payload.string.character;
402 result = ( wcsncmp( a_buff, b_buff, i ) == 0 )
struct cons_pointer c_cdr(struct cons_pointer arg)
Implementation of cdr in C.
int c_length(struct cons_pointer arg)
Implementation of length in C.
struct cons_pointer c_car(struct cons_pointer arg)
Implementation of car in C.
#define KEYTV
The string KEYW, considered as an unsigned int.
#define VECTORPOINTTV
The string VECP, considered as an unsigned int.
#define SYMBOLTV
The string SYMB, considered as an unsigned int.
union cons_space_object::@2 tag
union cons_space_object::@3 payload
uint32_t page
the index of the page on which this cell resides
#define STRINGTV
The string STRG, considered as an unsigned int.
#define INTEGERTV
The string INTR, considered as an unsigned int.
#define RATIOTV
The string RTIO, considered as an unsigned int.
#define CONSTV
The string CONS, considered as an unsigned int.
#define nilp(conspoint)
true if conspoint points to the special cell NIL, else false (there should only be one of these so it...
#define NLAMBDATV
The string NLMD, considered as an unsigned int.
uint32_t offset
the index of the cell within the page
#define REALTV
The string REAL, considered as an unsigned int.
#define LAMBDATV
The string LMDA, considered as an unsigned int.
#define pointer2cell(pointer)
given a cons_pointer as argument, return the cell.
#define numberp(conspoint)
true if conspoint points to some sort of a number cell, else false
An indirect pointer to a cons cell.
void debug_printf(int level, wchar_t *format,...)
wprintf adapted for the debug logging system.
void debug_print(wchar_t *message, int level)
print this debug message to stderr, if verbosity matches level.
void debug_print_object(struct cons_pointer pointer, int level)
print the object indicated by this pointer to stderr, if verbosity matches level.
#define DEBUG_ARITH
Print messages debugging arithmetic operations.
bool equal_ld_ld(long double a, long double b)
compare two long doubles and returns true if they are the same to within a tolerance of one part in a...
bool equal_integer_number(struct cons_pointer a, struct cons_pointer b)
Private function, don't use.
bool equal_number_number(struct cons_pointer a, struct cons_pointer b)
Private function, don't use.
bool same_type(struct cons_pointer a, struct cons_pointer b)
True if the objects at these two cons pointers have the same tag, else false.
bool equal_integer_real(struct cons_pointer a, struct cons_pointer b)
Private function, don't use.
bool end_of_string(struct cons_pointer string)
Some strings will be null terminated and some will be NIL terminated... ooops!
bool equal_real_number(struct cons_pointer a, struct cons_pointer b)
Private function, don't use.
bool equal_map_map(struct cons_pointer a, struct cons_pointer b)
equality of two map-like things.
bool equal(struct cons_pointer a, struct cons_pointer b)
Deep, and thus expensive, equality: true if these two objects have identical structure,...
bool equal_vector_vector(struct cons_pointer a, struct cons_pointer b)
equality of two vector-space things.
bool eq(struct cons_pointer a, struct cons_pointer b)
Shallow, and thus cheap, equality: true if these two objects are the same object, else false.
#define STRING_SHIPYARD_SIZE
equal.h
bool equal_integer_integer(struct cons_pointer a, struct cons_pointer b)
true if a and be are both integers whose value is the same value.
struct cons_pointer hashmap_get(struct cons_pointer mapp, struct cons_pointer key)
Get a value from a hashmap.
struct cons_pointer hashmap_keys(struct cons_pointer mapp)
return a flat list of all the keys in the hashmap indicated by map.
long double c_ratio_to_ld(struct cons_pointer rat)
convert a ratio to an equivalent long double.
bool equal_ratio_ratio(struct cons_pointer a, struct cons_pointer b)
True if a and be are identical rationals, else false.
#define pointer_to_vso(pointer)
given a pointer to a vector space object, return the object.
struct vector_space_header header
the header of this object
union vector_space_header::@4 tag
the tag (type) of this vector-space object.
#define vectorp(conspoint)
a vector_space_object is just a vector_space_header followed by a lump of bytes; what we deem to be i...