scm: to_scm: use cons, not append

It's faster.
This commit is contained in:
Dirk-Jan C. Binnema
2025-08-22 08:08:32 +03:00
parent c207921cfa
commit 3b7e5507f7

View File

@ -223,9 +223,8 @@ namespace Mu::Scm {
return scm_from_utf8_string(val); return scm_from_utf8_string(val);
else if constexpr (std::is_same_v<Type, std::vector<std::string>>) { else if constexpr (std::is_same_v<Type, std::vector<std::string>>) {
SCM lst{SCM_EOL}; SCM lst{SCM_EOL};
for (const auto& s: val) for (auto it = val.end(); it-- != val.begin();)
lst = scm_append_x(scm_list_2(lst, lst = scm_cons(to_scm(*it), lst);
scm_list_1(to_scm(s))));
return lst; return lst;
} }
else if constexpr (std::is_same_v<Type, bool>) else if constexpr (std::is_same_v<Type, bool>)