Skip to content
Snippets Groups Projects
Commit 61f1cc60 authored by w328li's avatar w328li
Browse files

clean up code

parent 667a2f3e
No related branches found
No related tags found
No related merge requests found
......@@ -83,9 +83,7 @@ cons_cell* create_op(char *op) {
return create_cons_cell_w_atom(operator, op_cons);
}
// todo: why need ra
cons_cell* create_comp_operator(cons_cell* op, cons_cell* term1, cons_cell* term2) {
cons_cell* term2_cons = create_cons_cell(term2, NULL);
cons_cell* term1_cons = create_cons_cell(term1, term2_cons);
cons_cell* op_cons = create_cons_cell(op, term1_cons);
......@@ -120,12 +118,6 @@ cons_cell* create_union_operator(cons_cell* ra1, cons_cell* ra2) {
}
cons_cell* create_and_operator(cons_cell* ra1, cons_cell* ra2) {
// cons_cell* create_and_operator(cons_cell* ra1) {
// cons_cell* ra_cons = create_cons_cell(ra1, NULL);
// char operator[4] = "AND\0";
// cons_cell* operator_cons = create_cons_cell_w_atom(operator, ra_cons);
// return operator_cons;
printf("create_and_operator called \n");
cons_cell* ra2_cons = create_cons_cell(ra2, NULL);
cons_cell* ra1_cons = create_cons_cell(ra1, ra2_cons);
......@@ -158,7 +150,6 @@ cons_cell* create_cross_operator(cons_cell* ra1, cons_cell* ra2) {
return operator_cons;
}
// For when you want to assign column names to another name
cons_cell* create_rename_operator(cons_cell* table, cons_cell* var) {
cons_cell* original_cons = create_cons_cell(table, var);
char operator[7] = "RENAME\0";
......@@ -223,30 +214,21 @@ void print_cons_tree(cons_cell *root) {
}
void print_cons_tree_helper(cons_cell *root, int indent) {
// ("eight\n");
if (root == NULL) {
// printf("six\n");
return;
}
// printf("nine\n");
bool tmp_atom = root->is_atom;
// printf("ten\n");
if (root->is_atom) {
// printf("four\n");
for (int i = 0; i < indent; i++) {
printf(" ");
}
printf("%s", ((atom*)root->car)->val);
printf("\n");
// printf("one\n");
print_cons_tree_helper(root->cdr, indent+1);
} else {
// printf("five\n");
cons_cell* tmp = (cons_cell*)root->car;
// printf("seven\n");
print_cons_tree_helper((cons_cell*)root->car, indent);
// printf("three\n");
print_cons_tree_helper(root->cdr, indent);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment