From e4f96530b474c98702a443f0f92e82ed3b332ad3 Mon Sep 17 00:00:00 2001 From: jeaye Date: Thu, 28 Nov 2024 21:32:32 -0800 Subject: [PATCH] Fix C API = impl to visit seqable --- .../src/cpp/clojure/core_native.cpp | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/compiler+runtime/src/cpp/clojure/core_native.cpp b/compiler+runtime/src/cpp/clojure/core_native.cpp index 081f97b8..bf4f3253 100644 --- a/compiler+runtime/src/cpp/clojure/core_native.cpp +++ b/compiler+runtime/src/cpp/clojure/core_native.cpp @@ -491,15 +491,20 @@ jank_object_ptr jank_load_clojure_core_native() return obj::boolean::false_const(); } - for(auto it(fresh_seq(rest)); it != nullptr; it = next_in_place(it)) - { - if(!equal(l, first(it))) - { - return obj::boolean::false_const(); - } - } - - return obj::boolean::true_const(); + return visit_seqable( + [](auto const typed_rest, object_ptr const l) { + for(auto it(typed_rest->fresh_seq()); it != nullptr; it = it->next_in_place()) + { + if(!equal(l, it->first())) + { + return obj::boolean::false_const(); + } + } + + return obj::boolean::true_const(); + }, + rest, + l); }; intern_fn_obj("=", fn); }