mirror of
https://github.com/open-goal/jak-project
synced 2026-09-12 12:55:22 -04:00
27 lines
970 B
C++
27 lines
970 B
C++
#include "Goal.h"
|
|
|
|
std::shared_ptr<Place> Goal::compile_car(const Object& form,
|
|
Object rest,
|
|
std::shared_ptr<GoalEnv> env) {
|
|
auto arg = pair_car(rest);
|
|
rest = pair_cdr(rest);
|
|
if (rest.type != EMPTY_LIST) {
|
|
throw_compile_error(form, "can't do this car");
|
|
}
|
|
|
|
return std::make_shared<PairPlace>(get_base_typespec("object"), true,
|
|
compile_error_guard(arg, env));
|
|
}
|
|
|
|
std::shared_ptr<Place> Goal::compile_cdr(const Object& form,
|
|
Object rest,
|
|
std::shared_ptr<GoalEnv> env) {
|
|
auto arg = pair_car(rest);
|
|
rest = pair_cdr(rest);
|
|
if (rest.type != EMPTY_LIST) {
|
|
throw_compile_error(form, "can't do this cdr");
|
|
}
|
|
|
|
return std::make_shared<PairPlace>(get_base_typespec("object"), false,
|
|
compile_error_guard(arg, env));
|
|
} |