Commit fc2c3419d6be9340eb53467dc25d8f8398429fc2

jeremy 2024-11-05T11:20:07

crypt sha512

diff --git a/lib/kc3/0.1/sym.facts b/lib/kc3/0.1/sym.facts
index e567255..a9c76f7 100644
--- a/lib/kc3/0.1/sym.facts
+++ b/lib/kc3/0.1/sym.facts
@@ -11,6 +11,8 @@ add {Sym, :symbol, Sym.anon_serial}
 replace {Sym.anon_serial, :symbol_value, 0}
 add {Sym, :symbol, Sym.anon}
 replace {Sym.anon, :symbol_value, Sym.fn (prefix) {
-  def Sym.anon_serial = anon_serial + 1
-  "#{prefix}-#{anon_serial}"
+  while Sym.find("#{prefix}-#{anon_serial}") do
+    def Sym.anon_serial = Sym.anon_serial + 1
+  end
+  (Sym) "#{prefix}-#{anon_serial}"
 }}
diff --git a/libkc3/kc3.c b/libkc3/kc3.c
index 9e4415a..c9e96a4 100644
--- a/libkc3/kc3.c
+++ b/libkc3/kc3.c
@@ -357,21 +357,21 @@ s_str * kc3_getenv (const s_str *name, s_str *dest)
 s_tag * kc3_if_then_else (const s_tag *cond, const s_tag *then,
                           const s_tag *else_, s_tag *dest)
 {
-  bool  cond_bool;
+  bool  cond_bool = false;
   s_tag cond_eval = {0};
   const s_sym *type;
-  if (! env_eval_tag(&g_kc3_env, cond, &cond_eval))
-    return NULL;
-  if (cond_eval.type == TAG_BOOL)
-    cond_bool = cond_eval.data.bool;
-  else {
-    type = &g_sym_Bool;
-    if (! bool_init_cast(&cond_bool, &type, &cond_eval)) {
-      tag_clean(&cond_eval);
-      return NULL;
+  if (env_eval_tag(&g_kc3_env, cond, &cond_eval)) {
+    if (cond_eval.type == TAG_BOOL)
+      cond_bool = cond_eval.data.bool;
+    else {
+      type = &g_sym_Bool;
+      if (! bool_init_cast(&cond_bool, &type, &cond_eval)) {
+        tag_clean(&cond_eval);
+        return NULL;
+      }
     }
+    tag_clean(&cond_eval);
   }
-  tag_clean(&cond_eval);
   if (cond_bool) {
     if (! env_eval_tag(&g_kc3_env, then, dest))
       return NULL;