mirror of
https://github.com/kanaka/mal.git
synced 2024-09-11 13:55:55 +03:00
all tests passed
This commit is contained in:
parent
843ca9ade7
commit
e436fb15aa
@ -286,14 +286,11 @@ std::shared_ptr<MalType> apply(std::vector<std::shared_ptr<MalType>> args)
|
|||||||
{
|
{
|
||||||
std::vector<std::shared_ptr<MalType>> list;
|
std::vector<std::shared_ptr<MalType>> list;
|
||||||
|
|
||||||
for (unsigned i = 1; i < args.size(); ++i)
|
for (unsigned i = 1; i < args.size() - 1; ++i)
|
||||||
{
|
list.push_back(args[i]);
|
||||||
if (args[i]->type() == MalType::Type::List)
|
|
||||||
for (auto item : static_cast<MalList &>(*args[i]))
|
for (auto item : static_cast<MalList &>(*args[args.size() - 1]))
|
||||||
list.push_back(item);
|
list.push_back(item);
|
||||||
else
|
|
||||||
list.push_back(args[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto &func = static_cast<MalFunc &>(*args[0]);
|
auto &func = static_cast<MalFunc &>(*args[0]);
|
||||||
return func(list);
|
return func(list);
|
||||||
|
Loading…
Reference in New Issue
Block a user