I would like to delete a list and append the fore-end and back-end list and generate a new list. I have the following two structures:
typedef struct term {
SYMBOL symbol;
union {
LIST termlist;
struct term* term;
} super;
LIST args;
NAT stamp;
NAT size;
} *TERM, TERM_NODE;
typedef struct LIST_HELP {
struct LIST_HELP *cdr;
POINTER car;
} LIST_NODE;
typedef LIST_NODE *LIST;
Using these two structure I have a TERM like:
forall([X8,X9],implies(connected(X8,X9),exists([V],and(or(equal(h_1(X8),U),equal(h_2(X8),U)),connected(U,X9)))
Here all are symbols. Suppose if forall is a symbol then the rest act as the arguments for forall. It is a kind of Term composed of another Term. I would like to remove [V] from this and append the list before and after of it. Can you please tell me how I would do that?
Probably homework; so, lets say you have a list
LIST l1, you find it’s cdr byl1->cdr. Now: To delete one entry from the list what you want to do is set the cdr’s cdr as the current’s cdr like so:You effectively deleted the entry that was previously in
l1->cdr. What you also have to do is remember that previous value ofl1->cdrso you can free the memory used by it.