utree eval (utree& ut) const { phxpr::shared_ptr<runtime_environment> eptr = ut.get<runtime_environment*>()->checkout(); if (!eptr) { BOOST_THROW_EXCEPTION (invalid_placeholder(n, frame, eptr, arity_type::fixed)); } while (frame != eptr->level()) { if (!eptr->outer()) { BOOST_THROW_EXCEPTION (invalid_placeholder(n, frame, eptr, arity_type::fixed)); } eptr = eptr->outer(); } if (eptr->size() <= n) { BOOST_THROW_EXCEPTION (invalid_placeholder(n, frame, eptr, arity_type::fixed)); } return utree((*eptr)[n]); }
utree eval (utree& ut) const { phxpr::shared_ptr<runtime_environment> eptr = ut.get<runtime_environment*>()->checkout(); if (!eptr) { BOOST_THROW_EXCEPTION (invalid_local_assignment(n, frame, eptr, arity_type::fixed)); } while (frame != eptr->level()) { if (!eptr->outer()) { BOOST_THROW_EXCEPTION (invalid_local_assignment(n, frame, eptr, arity_type::fixed)); } eptr = eptr->outer(); } if (eptr->size() <= n) { BOOST_THROW_EXCEPTION (invalid_local_assignment(n, frame, eptr, arity_type::fixed)); } (*eptr)[n] = eptr->invoke(value); // assignment returns unspecified return utree(); }
utree eval(scope const& env) const { scope const* eptr = &env; utree const& arg = (*eptr)[n]; if (arg.which() != utree_type::function_type) return utree(boost::ref(arg)); else return arg.eval(*eptr); }
utree eval(scope const& env) const { scope const* eptr = &env; while (level != eptr->level()) eptr = eptr->outer(); utree const& arg = (*eptr)[n]; if (arg.which() != utree_type::function_type) return utree(boost::ref(arg)); else return arg.eval(*eptr); }
utree eval(scope const& env) const { scope const* eptr = &env; utree result; for (std::size_t i = n; i < eptr->size(); ++i) { utree const& arg = (*eptr)[i]; if (arg.which() != utree_type::function_type) result.push_back(utree(boost::ref(arg))); else result.push_back(arg.eval(*eptr)); } return result; }
function operator()(T const& val) const { return scheme::val(utree(val)); }
utree dispatch(A const&, boost::mpl::false_) const { return utree(); // cannot apply to non-integral types }
utree dispatch(A const&, boost::mpl::false_) const { return utree(); // cannot apply to non-arithmetic types }
static function as_function(T const& val) { return scheme::val(utree(val)); }
utree eval(scope const& /*env*/) const { return utree(boost::ref(val)); }
utree eval (utree const& subject) const { if (!predicate(subject)) BOOST_THROW_EXCEPTION(assertion_failed()); return utree(); }
utree dispatch(A&, boost::mpl::false_) const { // $$$ Throw exception here? $$$ return utree(); // cannot apply to non-integral types }
utree operator()(A const& a) const { // $$$ Throw exception here? $$$ return utree(); // cannot apply to non booleans }