VALUE
build_py_sexpr(lisp_object_t* cur)
{
  if (lisp_cons_p(cur))
    {
      VALUE lst = rb_ary_new();
  
      while (cur)
        {
          rb_ary_push(lst, build_py_sexpr(lisp_car(cur)));
          cur = lisp_cdr(cur);
        }
      
      return lst;
    }
  else if (lisp_string_p(cur))
    {
      return rb_str_new2(lisp_string(cur));
    }
  else if (lisp_symbol_p(cur))
    {
      return ID2SYM(rb_intern(lisp_symbol(cur)));
    }
  else if (lisp_integer_p(cur))
    {
      return INT2NUM(lisp_integer(cur));
    }
  else if (lisp_real_p(cur))
    {
      return rb_float_new(lisp_real(cur));
    }
  else if (lisp_boolean_p(cur))
    {
      if (lisp_boolean(cur))
        return Qtrue;
      else
        return Qfalse;
    }
  else
    {
      return Qnil;
    }
}
Пример #2
0
sexpr imports(const std::vector<sexpr>& a, environment* env)
{
	std::vector<sexpr> l;
	l.push_back(sexpr(lisp_string("/home/icepic/Code/lisp++/lisp.el")));
	return import(l, env);
}