Skip to content

Commit

Permalink
all tests passed
Browse files Browse the repository at this point in the history
  • Loading branch information
yang-le committed Jul 24, 2023
1 parent 843ca9a commit e436fb1
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions impls/cc/core.cc
Original file line number Diff line number Diff line change
Expand Up @@ -286,14 +286,11 @@ std::shared_ptr<MalType> apply(std::vector<std::shared_ptr<MalType>> args)
{
std::vector<std::shared_ptr<MalType>> list;

for (unsigned i = 1; i < args.size(); ++i)
{
if (args[i]->type() == MalType::Type::List)
for (auto item : static_cast<MalList &>(*args[i]))
list.push_back(item);
else
list.push_back(args[i]);
}
for (unsigned i = 1; i < args.size() - 1; ++i)
list.push_back(args[i]);

for (auto item : static_cast<MalList &>(*args[args.size() - 1]))
list.push_back(item);

auto &func = static_cast<MalFunc &>(*args[0]);
return func(list);
Expand Down

0 comments on commit e436fb1

Please sign in to comment.