/*
 * Unused list (replacedwith STL vector)
 *
 * Author(s) : Catalin Dumitrescu (catalind@acm.org)
 *
 * File: licst.cc
 * Created: Mon Aug 27 10:15:57 CDT 2001
 *
 */


#include "scheme_exc.hh"
#include "object.hh"
#include "list.hh"

object*
list::clone ()
{
  list *lst = new list;

  for (int i = 0; i < this->content.size(); i++)
    lst->content.push_back (this->content[i]->clone ());
  return lst;
}

object* 
list::evaluate (bool, object*) 
{ return this; }

void
list::print (ostream& out)
{
  int i; out << "(";
  for (i = 0; i < content.size () - 1; i++)
    { content[i]->print (out); out << " "; }
  content[i]->print (out); out << ")";
}


object*
list::car ()
{
  return content[0]->clone ();
}

object*
list::cdr ()
{
  list *lst = new list;

  for (int i = 1; i < this->content.size(); i++)
    lst->content.push_back (this->content[i]->clone ());
  return lst;
}

void
list::add (object* obj)
{
  if (obj->getType () != LIST)
    content.push_back (obj->clone ());
  else
    ;
}

