#pragma once #define TYPE(x) ((x).type) #define CONS(x) ((x).value.consCell) #define CAR(x) (((x).value.consCell)->car) #define CDR(x) (((x).value.consCell)->cdr) #define SYM(x) ((x).value.symbol) #define ERR(x) ((x).value.err) #define NUM(x) ((x).value.num) #define NUM_TYPE(x) ((x).value.num.type) #define NUM_NUMER(x) ((x).value.num.value.fraction.numerator) #define NUM_DENOM(x) ((x).value.num.value.fraction.denominator) #define NUM_REAL(x) ((x).value.num.value.real) typedef enum { nilObject, consObject, numberObject, symbolObject, errorObject } dataType; typedef enum { improperListError, typeError, unrecognizedSymbolError, notApplicableError, divisionByZeroError, argumentNumberError, syntaxError } error; typedef struct object object; typedef struct cons cons; typedef enum { fractionNum, realNum } numType; typedef struct number { numType type; union { long double real; struct { long long int numerator; long long int denominator; } fraction; } value; } number; struct object { dataType type; union { error err; char *symbol; cons *consCell; number num; } value; }; struct cons { object car; object cdr; }; int properList(object list); int listLength(object list); void deleteObject(object input); object copyObject(object input); object longlongToNumber(long long int input); object shortenFractionNum(object a); object exactToInexactNum(object a); object inexactToExactNum(object a); object plusNum(object a, object b); object minusNum(object a); object timesNum(object a, object b); object inverseNum(object a);