def make_list(list): root = cons = Cons.Cons(make_atom(list[0]), NIL) list = list[1:] for x in list: cons = add_to_list(cons, x) return root
def build_atom_from_cons(car, cdr, parent=None): """Build an atom containing a Cons object Keyword arguments: car -- the first element of the cons cdr -- the second element of the cons parent -- the parent cons of this cons""" return Atom(Atom.CONS, Cons.Cons(car, cdr, parent))