-
-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
invalid map entry: nil #261
Comments
Also related, certain map types cannot be merged due to hardcoding.
|
I looked into this. One solution could be to pull out a common helper to define object_ptr conj_map_like(object_ptr const m, object_ptr const head)
{
// fix (conj {} nil)
if(head == obj::nil::nil_const())
{
return m;
}
// fix (merge {} (sorted-map))
if(is_map(head->type))
{
return runtime::merge(m, head);
}
if(head->type != object_type::persistent_vector)
{
throw std::runtime_error{ fmt::format("invalid map entry: {}", runtime::to_string(head)) };
}
auto const vec(expect_object<obj::persistent_vector>(head));
if(vec->count() != 2)
{
throw std::runtime_error{ fmt::format("invalid map entry: {}", runtime::to_string(head)) };
}
return assoc(m, vec->data[0], vec->data[1]);
} |
This code predates |
The text was updated successfully, but these errors were encountered: