in include/S_Expression.h [509:527]
bool equals(const std::shared_ptr<Component>& other) const {
if (this == other.get()) {
// Since S-expressions can share structure, checking for pointer equality
// prevents unnecessary computations.
return true;
}
if (other->kind() != ComponentKind::List) {
return false;
}
auto l = std::static_pointer_cast<List>(other);
if (l->m_list.size() != m_list.size()) {
return false;
}
return std::equal(
m_list.begin(),
m_list.end(),
l->m_list.begin(),
[](const s_expr& e1, const s_expr& e2) { return e1.equals(e2); });
}