diff --git a/.ic3_history b/.ic3_history
index 8a760a8..bb0aca1 100644
--- a/.ic3_history
+++ b/.ic3_history
@@ -1,4 +1,3 @@
-name = quote n
quote "Hello, " + (unquote name) + " !"
m = macro (name) { quote "Hello, " + (unquote name) + " !" }
n = "123"
@@ -97,3 +96,4 @@ sqrt(4)
sqrt(9)
sqrt(16)
sqrt(-1)
+1 + 2 +i 3
diff --git a/lib/c3/0.1/c3.facts b/lib/c3/0.1/c3.facts
index 1e5e4b9..7a03ba2 100644
--- a/lib/c3/0.1/c3.facts
+++ b/lib/c3/0.1/c3.facts
@@ -71,6 +71,13 @@ replace {C3.operator_add, :arity, 2}
replace {C3.operator_add, :cfn, cfn Tag "tag_add" (Tag, Tag, Result)}
replace {C3.operator_add, :operator_precedence, 10}
replace {C3.operator_add, :operator_associativity, :left}
+add {C3, :operator, C3.operator_addi}
+replace {C3.operator_addi, :is_a, :operator}
+replace {C3.operator_addi, :symbol, :+i}
+replace {C3.operator_addi, :arity, 2}
+replace {C3.operator_addi, :cfn, cfn Tag "tag_addi" (Tag, Tag, Result)}
+replace {C3.operator_addi, :operator_precedence, 10}
+replace {C3.operator_addi, :operator_associativity, :left}
add {C3, :operator, C3.operator_sub}
replace {C3.operator_sub, :is_a, :operator}
replace {C3.operator_sub, :symbol, :-}
diff --git a/libc3/bool.c b/libc3/bool.c
index 4cc9f8e..f4c07b4 100644
--- a/libc3/bool.c
+++ b/libc3/bool.c
@@ -27,8 +27,8 @@ bool * bool_init_cast (bool *b, const s_tag *tag)
switch (tag->type) {
case TAG_BOOL: *b = tag->data.bool; return b;
case TAG_CHARACTER: *b = (bool) tag->data.character; return b;
- //case TAG_COMPLEX: *b = ! complex_is_zero(tag->data.complex);
- // return b;
+ case TAG_COMPLEX: *b = ! complex_is_zero(tag->data.complex);
+ return b;
case TAG_F32: *b = (bool) tag->data.f32; return b;
case TAG_F64: *b = (bool) tag->data.f64; return b;
case TAG_F128: *b = (bool) tag->data.f128; return b;
diff --git a/libc3/buf_inspect.c b/libc3/buf_inspect.c
index df98d91..92173e9 100644
--- a/libc3/buf_inspect.c
+++ b/libc3/buf_inspect.c
@@ -779,22 +779,19 @@ sw buf_inspect_character_size (const character *c)
return result;
}
-/*
sw buf_inspect_complex (s_buf *buf, const s_complex *c)
{
- s_struct s;
sw r;
sw result = 0;
s_buf_save save;
buf_save_init(buf, &save);
- if (! struct_init_with_data(&s, &g_sym_Complex, false, c)) {
- r = -2;
- goto clean;
- }
- if ((r = buf_inspect_struct(buf, c)) <= 0)
+ if ((r = buf_inspect_tag(buf, &c->x)) < 0)
goto restore;
result += r;
- if ((
+ if ((r = buf_write_1(buf, " +i ")) < 0)
+ goto restore;
+ result += r;
+ if ((r = buf_inspect_tag(buf, &c->y)) < 0)
goto restore;
result += r;
r = result;
@@ -803,21 +800,22 @@ sw buf_inspect_complex (s_buf *buf, const s_complex *c)
buf_save_restore_wpos(buf, &save);
clean:
buf_save_clean(buf, &save);
- return result;
+ return r;
}
-sw buf_inspect_complex_size (const complex *c)
+sw buf_inspect_complex_size (const s_complex *c)
{
sw r;
sw result = 0;
- result += strlen("'");
- if ((r = buf_inspect_str_complex_size(c)) <= 0)
+ if ((r = buf_inspect_tag_size(&c->x)) < 0)
+ return r;
+ result += r;
+ result += strlen(" +i ");
+ if ((r = buf_inspect_tag_size(&c->y)) < 0)
return r;
result += r;
- result += strlen("'");
return result;
}
-*/
sw buf_inspect_f32 (s_buf *buf, const f32 *f)
{
@@ -2302,6 +2300,7 @@ sw buf_inspect_tag (s_buf *buf, const s_tag *tag)
case TAG_CFN: return buf_inspect_cfn(buf, &tag->data.cfn);
case TAG_CHARACTER:
return buf_inspect_character(buf, &tag->data.character);
+ case TAG_COMPLEX: return buf_inspect_complex(buf, tag->data.complex);
case TAG_F32: return buf_inspect_f32(buf, &tag->data.f32);
case TAG_F64: return buf_inspect_f64(buf, &tag->data.f64);
case TAG_F128: return buf_inspect_f128(buf, &tag->data.f128);
@@ -2354,6 +2353,7 @@ sw buf_inspect_tag_size (const s_tag *tag)
case TAG_CFN: return buf_inspect_cfn_size(&tag->data.cfn);
case TAG_CHARACTER:
return buf_inspect_character_size(&tag->data.character);
+ case TAG_COMPLEX: return buf_inspect_complex_size(tag->data.complex);
case TAG_F32: return buf_inspect_f32_size(&tag->data.f32);
case TAG_F64: return buf_inspect_f64_size(&tag->data.f64);
case TAG_F128: return buf_inspect_f128_size(&tag->data.f128);
diff --git a/libc3/compare.c b/libc3/compare.c
index 56b0ba3..f74479f 100644
--- a/libc3/compare.c
+++ b/libc3/compare.c
@@ -13,9 +13,11 @@
#include "assert.h"
#include <string.h>
#include "compare.h"
+#include "complex.h"
#include "data.h"
#include "integer.h"
#include "list.h"
+#include "ratio.h"
#include "tag.h"
#define COMPARE_DEF(type) \
@@ -117,6 +119,35 @@ s8 compare_cfn (const s_cfn *a, const s_cfn *b)
}
COMPARE_DEF(character)
+
+s8 compare_complex (const s_complex *a, const s_complex *b)
+{
+ s_tag aa = {0};
+ s_tag ax2 = {0};
+ s_tag ay2 = {0};
+ s_tag bb = {0};
+ s_tag bx2 = {0};
+ s_tag by2 = {0};
+ s8 r;
+ assert(a);
+ assert(b);
+ if (! tag_mul(&a->x, &a->x, &ax2) ||
+ ! tag_mul(&a->y, &a->y, &ay2) ||
+ ! tag_add(&ax2, &ay2, &aa) ||
+ ! tag_mul(&b->x, &b->x, &bx2) ||
+ ! tag_mul(&b->y, &b->y, &by2) ||
+ ! tag_add(&bx2, &by2, &bb))
+ abort();
+ r = compare_tag(&aa, &bb);
+ tag_clean(&bb);
+ tag_clean(&by2);
+ tag_clean(&bx2);
+ tag_clean(&aa);
+ tag_clean(&ay2);
+ tag_clean(&ax2);
+ return r;
+}
+
COMPARE_DEF(f32)
COMPARE_DEF(f64)
COMPARE_DEF(f128)
@@ -512,14 +543,26 @@ s8 compare_tag (const s_tag *a, const s_tag *b) {
b == TAG_FIRST)
return 1;
switch (a->type) {
+ case TAG_COMPLEX:
+ switch (b->type) {
+ case TAG_COMPLEX:
+ return compare_complex(a->data.complex, b->data.complex);
+ default:
+ break;
+ }
+ break;
case TAG_F32:
switch (b->type) {
+ case TAG_COMPLEX:
+ return compare_f32(a->data.f32, complex_to_f32(b->data.complex));
case TAG_F32: return compare_f32(a->data.f32, b->data.f32);
case TAG_F64: return compare_f64((f64) a->data.f32, b->data.f64);
case TAG_F128:
return compare_f128((f128) a->data.f32, b->data.f128);
case TAG_INTEGER:
return compare_f32(a->data.f32, integer_to_f32(&b->data.integer));
+ case TAG_RATIO:
+ return compare_f32(a->data.f32, ratio_to_f32(&b->data.ratio));
case TAG_S8: return compare_f32(a->data.f32, (f32) b->data.s8);
case TAG_S16: return compare_f32(a->data.f32, (f32) b->data.s16);
case TAG_S32: return compare_f32(a->data.f32, (f32) b->data.s32);
@@ -536,6 +579,8 @@ s8 compare_tag (const s_tag *a, const s_tag *b) {
break;
case TAG_F64:
switch (b->type) {
+ case TAG_COMPLEX:
+ return compare_f64(a->data.f64, complex_to_f64(b->data.complex));
case TAG_F32: return compare_f64(a->data.f64, b->data.f32);
case TAG_F64: return compare_f64((f64) a->data.f64, b->data.f64);
case TAG_F128:
@@ -621,6 +666,14 @@ s8 compare_tag (const s_tag *a, const s_tag *b) {
break;
}
break;
+ case TAG_RATIO:
+ switch (b->type) {
+ case TAG_RATIO:
+ return compare_ratio(&a->data.ratio, &b->data.ratio);
+ default:
+ break;
+ }
+ break;
case TAG_S8:
switch (b->type) {
case TAG_F32: return compare_f32((f32) a->data.s8, b->data.f32);
@@ -929,8 +982,6 @@ s8 compare_tag (const s_tag *a, const s_tag *b) {
b->data.ptr_free.p);
case TAG_QUOTE: return compare_quote(&a->data.quote,
&b->data.quote);
- case TAG_RATIO: return compare_ratio(&a->data.ratio,
- &b->data.ratio);
case TAG_STR: return compare_str(&a->data.str, &b->data.str);
case TAG_STRUCT: return compare_struct(&a->data.struct_,
&b->data.struct_);
@@ -943,10 +994,12 @@ s8 compare_tag (const s_tag *a, const s_tag *b) {
case TAG_UNQUOTE: return compare_unquote(&a->data.unquote,
&b->data.unquote);
case TAG_VAR: return compare_ptr(a, b);
+ case TAG_COMPLEX:
case TAG_F32:
case TAG_F64:
case TAG_F128:
case TAG_INTEGER:
+ case TAG_RATIO:
case TAG_S8:
case TAG_S16:
case TAG_S32:
diff --git a/libc3/compare.h b/libc3/compare.h
index 5237925..f891d7b 100644
--- a/libc3/compare.h
+++ b/libc3/compare.h
@@ -24,6 +24,7 @@ s8 compare_bool (bool a, bool b);
s8 compare_call (const s_call *a, const s_call *b);
s8 compare_cfn (const s_cfn *a, const s_cfn *b);
COMPARE_PROTOTYPE(character);
+s8 compare_complex (const s_complex *a, const s_complex *b);
COMPARE_PROTOTYPE(f32);
COMPARE_PROTOTYPE(f64);
COMPARE_PROTOTYPE(f128);
diff --git a/libc3/complex.c b/libc3/complex.c
index c8f624f..b58acb4 100644
--- a/libc3/complex.c
+++ b/libc3/complex.c
@@ -36,11 +36,18 @@ void complex_clean (s_complex *c)
tag_clean(&c->y);
}
+void complex_delete (s_complex *c)
+{
+ assert(c);
+ complex_clean(c);
+ free(c);
+}
+
s_complex * complex_init (s_complex *c)
{
assert(c);
- tag_init_f64(&c->x, 0);
- tag_init_f64(&c->y, 0);
+ tag_init_u8(&c->x, 0);
+ tag_init_u8(&c->y, 0);
return c;
}
diff --git a/libc3/complex.h b/libc3/complex.h
index 0b1179c..2f2a22f 100644
--- a/libc3/complex.h
+++ b/libc3/complex.h
@@ -39,6 +39,7 @@ s_complex * complex_div (const s_complex *a, const s_complex *b,
s_complex *dest);
/* Constructors, call complex_delete after use. */
+void complex_delete (s_complex *c);
s_complex * complex_new (void);
s_complex * complex_new_copy (const s_complex *a);
diff --git a/libc3/env.c b/libc3/env.c
index cc1c989..509c758 100644
--- a/libc3/env.c
+++ b/libc3/env.c
@@ -286,6 +286,29 @@ bool env_eval_call_resolve (s_env *env, s_call *call)
return call_get(call, &env->facts);
}
+bool env_eval_complex (s_env *env, const s_complex *c, s_tag *dest)
+{
+ s_complex *tmp = NULL;
+ assert(env);
+ assert(c);
+ assert(dest);
+ tmp = alloc(sizeof(s_complex));
+ if (! tmp)
+ return false;
+ if (! env_eval_tag(env, &c->x, &tmp->x)) {
+ free(tmp);
+ return false;
+ }
+ if (! env_eval_tag(env, &c->y, &tmp->y)) {
+ tag_clean(&tmp->x);
+ free(tmp);
+ return false;
+ }
+ dest->type = TAG_COMPLEX;
+ dest->data.complex = tmp;
+ return true;
+}
+
bool env_eval_equal_list (s_env *env, bool macro, const s_list *a,
const s_list *b, s_list **dest)
{
@@ -442,6 +465,7 @@ bool env_eval_equal_tag (s_env *env, bool macro, const s_tag *a,
return true;
}
switch (a->type) {
+ case TAG_COMPLEX:
case TAG_F32:
case TAG_F64:
case TAG_F128:
@@ -458,6 +482,7 @@ bool env_eval_equal_tag (s_env *env, bool macro, const s_tag *a,
case TAG_U64:
case TAG_UW:
switch (b->type) {
+ case TAG_COMPLEX:
case TAG_F32:
case TAG_F64:
case TAG_F128:
@@ -958,6 +983,7 @@ bool env_eval_quote_tag (s_env *env, const s_tag *tag, s_tag *dest)
case TAG_BOOL:
case TAG_CFN:
case TAG_CHARACTER:
+ case TAG_COMPLEX:
case TAG_F32:
case TAG_F64:
case TAG_F128:
@@ -1132,6 +1158,8 @@ bool env_eval_tag (s_env *env, const s_tag *tag, s_tag *dest)
return env_eval_block(env, &tag->data.block, dest);
case TAG_CALL:
return env_eval_call(env, &tag->data.call, dest);
+ case TAG_COMPLEX:
+ return env_eval_complex(env, tag->data.complex, dest);
case TAG_IDENT:
return env_eval_ident(env, &tag->data.ident, dest);
case TAG_LIST:
diff --git a/libc3/env.h b/libc3/env.h
index 49b5497..0f22ced 100644
--- a/libc3/env.h
+++ b/libc3/env.h
@@ -42,6 +42,8 @@ bool env_eval_call_cfn (s_env *env, const s_call *call,
bool env_eval_call_fn (s_env *env, const s_call *call,
s_tag *dest);
bool env_eval_call_resolve (s_env *env, s_call *call);
+bool env_eval_complex (s_env *env, const s_complex *c,
+ s_tag *dest);
bool env_eval_equal_block (s_env *env, bool macro,
const s_block *a, const s_block *b,
s_block *dest);
diff --git a/libc3/hash.c b/libc3/hash.c
index 786d47a..c6531c8 100644
--- a/libc3/hash.c
+++ b/libc3/hash.c
@@ -162,6 +162,19 @@ bool hash_update_cfn (t_hash *hash, const s_cfn *cfn)
HASH_UPDATE_DEF(char)
HASH_UPDATE_DEF(character)
+
+bool hash_update_complex (t_hash *hash, const s_complex *c)
+{
+ const s8 type[] = "complex";
+ assert(hash);
+ assert(c);
+ if (! hash_update(hash, type, sizeof(type)) ||
+ ! hash_update_tag(hash, &c->x) ||
+ ! hash_update_tag(hash, &c->y))
+ return false;
+ return true;
+}
+
HASH_UPDATE_DEF(f32)
HASH_UPDATE_DEF(f64)
HASH_UPDATE_DEF(f128)
@@ -338,8 +351,8 @@ bool hash_update_ratio (t_hash *hash, const s_ratio *ratio)
assert(hash);
assert(ratio);
if (! hash_update(hash, type, sizeof(type)) ||
- ! hash_update(hash, &ratio->numerator, sizeof(ratio->numerator)) ||
- ! hash_update(hash, &ratio->denominator, sizeof(ratio->denominator)))
+ ! hash_update_integer(hash, &ratio->numerator) ||
+ ! hash_update_integer(hash, &ratio->denominator))
return false;
return true;
}
@@ -441,52 +454,52 @@ bool hash_update_tag (t_hash *hash, const s_tag *tag)
if (! hash_update_u8(hash, &tag_type))
return false;
switch (tag->type) {
- case TAG_ARRAY: return hash_update_array(hash, &tag->data.array);
- case TAG_BLOCK: return hash_update_block(hash, &tag->data.block);
- case TAG_BOOL: return hash_update_bool(hash, &tag->data.bool);
- case TAG_CALL: return hash_update_call(hash, &tag->data.call);
- case TAG_CFN: return hash_update_cfn(hash, &tag->data.cfn);
+ case TAG_ARRAY: return hash_update_array(hash, &tag->data.array);
+ case TAG_BLOCK: return hash_update_block(hash, &tag->data.block);
+ case TAG_BOOL: return hash_update_bool(hash, &tag->data.bool);
+ case TAG_CALL: return hash_update_call(hash, &tag->data.call);
+ case TAG_CFN: return hash_update_cfn(hash, &tag->data.cfn);
case TAG_CHARACTER:
return hash_update_character(hash, &tag->data.character);
- case TAG_F32: return hash_update_f32(hash, &tag->data.f32);
- case TAG_F64: return hash_update_f64(hash, &tag->data.f64);
- case TAG_F128: return hash_update_f128(hash, &tag->data.f128);
- case TAG_FACT: return hash_update_fact(hash, &tag->data.fact);
- case TAG_FN: return hash_update_fn(hash, &tag->data.fn);
- case TAG_IDENT: return hash_update_ident(hash, &tag->data.ident);
+ case TAG_COMPLEX: return hash_update_complex(hash, tag->data.complex);
+ case TAG_F32: return hash_update_f32(hash, &tag->data.f32);
+ case TAG_F64: return hash_update_f64(hash, &tag->data.f64);
+ case TAG_F128: return hash_update_f128(hash, &tag->data.f128);
+ case TAG_FACT: return hash_update_fact(hash, &tag->data.fact);
+ case TAG_FN: return hash_update_fn(hash, &tag->data.fn);
+ case TAG_IDENT: return hash_update_ident(hash, &tag->data.ident);
case TAG_INTEGER:
return hash_update_integer(hash, &tag->data.integer);
case TAG_LIST:
return hash_update_list(hash, (const s_list * const *)
&tag->data.list);
- case TAG_MAP: return hash_update_map(hash, &tag->data.map);
- case TAG_PTAG: return hash_update_ptag(hash, &tag->data.ptag);
- case TAG_PTR: return hash_update_ptr(hash, &tag->data.ptr);
+ case TAG_MAP: return hash_update_map(hash, &tag->data.map);
+ case TAG_PTAG: return hash_update_ptag(hash, &tag->data.ptag);
+ case TAG_PTR: return hash_update_ptr(hash, &tag->data.ptr);
case TAG_PTR_FREE:
return hash_update_ptr_free(hash, &tag->data.ptr_free);
- case TAG_QUOTE: return hash_update_quote(hash, &tag->data.quote);
- case TAG_RATIO: return hash_update_ratio(hash, &tag->data.ratio);
- case TAG_S8: return hash_update_s8(hash, &tag->data.s8);
- case TAG_S16: return hash_update_s16(hash, &tag->data.s16);
- case TAG_S32: return hash_update_s32(hash, &tag->data.s32);
- case TAG_S64: return hash_update_s64(hash, &tag->data.s64);
- case TAG_SW: return hash_update_sw(hash, &tag->data.sw);
- case TAG_STR: return hash_update_str(hash, &tag->data.str);
- case TAG_STRUCT:
- return hash_update_struct(hash, &tag->data.struct_);
+ case TAG_QUOTE: return hash_update_quote(hash, &tag->data.quote);
+ case TAG_RATIO: return hash_update_ratio(hash, &tag->data.ratio);
+ case TAG_S8: return hash_update_s8(hash, &tag->data.s8);
+ case TAG_S16: return hash_update_s16(hash, &tag->data.s16);
+ case TAG_S32: return hash_update_s32(hash, &tag->data.s32);
+ case TAG_S64: return hash_update_s64(hash, &tag->data.s64);
+ case TAG_SW: return hash_update_sw(hash, &tag->data.sw);
+ case TAG_STR: return hash_update_str(hash, &tag->data.str);
+ case TAG_STRUCT: return hash_update_struct(hash, &tag->data.struct_);
case TAG_STRUCT_TYPE:
return hash_update_struct_type(hash, &tag->data.struct_type);
- case TAG_SYM: return hash_update_sym(hash, &tag->data.sym);
- case TAG_TUPLE: return hash_update_tuple(hash, &tag->data.tuple);
- case TAG_U8: return hash_update_u8(hash, &tag->data.u8);
- case TAG_U16: return hash_update_u16(hash, &tag->data.u16);
- case TAG_U32: return hash_update_u32(hash, &tag->data.u32);
- case TAG_U64: return hash_update_u64(hash, &tag->data.u64);
+ case TAG_SYM: return hash_update_sym(hash, &tag->data.sym);
+ case TAG_TUPLE: return hash_update_tuple(hash, &tag->data.tuple);
+ case TAG_U8: return hash_update_u8(hash, &tag->data.u8);
+ case TAG_U16: return hash_update_u16(hash, &tag->data.u16);
+ case TAG_U32: return hash_update_u32(hash, &tag->data.u32);
+ case TAG_U64: return hash_update_u64(hash, &tag->data.u64);
case TAG_UNQUOTE:
return hash_update_unquote(hash, &tag->data.unquote);
- case TAG_UW: return hash_update_uw(hash, &tag->data.uw);
- case TAG_VAR: return hash_update_var(hash, NULL);
- case TAG_VOID: return hash_update_void(hash, NULL);
+ case TAG_UW: return hash_update_uw(hash, &tag->data.uw);
+ case TAG_VAR: return hash_update_var(hash, NULL);
+ case TAG_VOID: return hash_update_void(hash, NULL);
}
err_puts("hash_update_tag: unknown tag type");
assert(! "hash_update_tag: unknown tag type");
diff --git a/libc3/hash.h b/libc3/hash.h
index e4871a4..86b8232 100644
--- a/libc3/hash.h
+++ b/libc3/hash.h
@@ -31,6 +31,7 @@ bool hash_update_call (t_hash *hash, const s_call *call);
bool hash_update_cfn (t_hash *hash, const s_cfn *cfn);
HASH_UPDATE_PROTOTYPE(char);
HASH_UPDATE_PROTOTYPE(character);
+bool hash_update_complex (t_hash *hash, const s_complex *c);
HASH_UPDATE_PROTOTYPE(f32);
HASH_UPDATE_PROTOTYPE(f64);
HASH_UPDATE_PROTOTYPE(f128);
diff --git a/libc3/tag.c b/libc3/tag.c
index c21d38f..65eaadd 100644
--- a/libc3/tag.c
+++ b/libc3/tag.c
@@ -21,6 +21,7 @@
#include "call.h"
#include "cfn.h"
#include "compare.h"
+#include "complex.h"
#include "env.h"
#include "fn.h"
#include "frame.h"
@@ -143,6 +144,7 @@ void tag_clean (s_tag *tag)
case TAG_BLOCK: block_clean(&tag->data.block); break;
case TAG_CALL: call_clean(&tag->data.call); break;
case TAG_CFN: cfn_clean(&tag->data.cfn); break;
+ case TAG_COMPLEX: complex_delete(tag->data.complex); break;
case TAG_FN: fn_clean(&tag->data.fn); break;
case TAG_INTEGER: integer_clean(&tag->data.integer); break;
case TAG_LIST: list_delete_all(tag->data.list); break;
@@ -322,6 +324,7 @@ s_tag * tag_init_copy (s_tag *tag, const s_tag *src)
tag_init_var(tag);
break;
case TAG_VOID:
+ tag_init_void(tag);
break;
case TAG_ARRAY:
array_init_copy(&tag->data.array, &src->data.array);
@@ -335,6 +338,9 @@ s_tag * tag_init_copy (s_tag *tag, const s_tag *src)
case TAG_CFN:
cfn_init_copy(&tag->data.cfn, &src->data.cfn);
break;
+ case TAG_COMPLEX:
+ tag->data.complex = complex_new_copy(src->data.complex);
+ break;
case TAG_FN:
fn_init_copy(&tag->data.fn, &src->data.fn);
break;
@@ -464,18 +470,51 @@ bool tag_is_number (const s_tag *tag)
{
assert(tag);
switch (tag->type) {
+ case TAG_VOID:
+ case TAG_ARRAY:
+ case TAG_BLOCK:
+ case TAG_BOOL:
+ case TAG_CALL:
+ case TAG_CFN:
+ case TAG_CHARACTER:
+ case TAG_FACT:
+ case TAG_FN:
+ case TAG_LIST:
+ case TAG_MAP:
+ case TAG_PTAG:
+ case TAG_PTR:
+ case TAG_PTR_FREE:
+ case TAG_QUOTE:
+ case TAG_STR:
+ case TAG_STRUCT:
+ case TAG_STRUCT_TYPE:
+ case TAG_SYM:
+ case TAG_TUPLE:
+ case TAG_UNQUOTE:
+ case TAG_VAR:
+ case TAG_IDENT:
+ return false;
+ case TAG_COMPLEX:
+ case TAG_F32:
+ case TAG_F64:
+ case TAG_F128:
case TAG_INTEGER:
- case TAG_S8:
- case TAG_S16:
- case TAG_S32:
+ case TAG_RATIO:
+ case TAG_SW:
case TAG_S64:
+ case TAG_S32:
+ case TAG_S16:
+ case TAG_S8:
case TAG_U8:
case TAG_U16:
case TAG_U32:
case TAG_U64:
+ case TAG_UW:
return true;
- default: ;
}
+ err_puts("tag_is_number: invalid tag type");
+ assert(! "tag_is_number: invalid tag type");
+ abort();
return false;
}
diff --git a/libc3/types.h b/libc3/types.h
index c119f8a..fc9aac3 100644
--- a/libc3/types.h
+++ b/libc3/types.h
@@ -96,7 +96,7 @@ typedef enum {
TAG_CALL,
TAG_CFN,
TAG_CHARACTER,
- //TAG_COMPLEX,
+ TAG_COMPLEX,
TAG_F32,
TAG_F64,
TAG_F128,