Commit 453f5581bd42fcb28659bb0597a26e99111a5fb1

Thomas de Grivel 2023-09-24T11:57:36

wip integer arrays

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
diff --git a/libc3/array.c b/libc3/array.c
index d78c862..9f0ad69 100644
--- a/libc3/array.c
+++ b/libc3/array.c
@@ -15,13 +15,41 @@
 #include <string.h>
 #include <err.h>
 #include "array.h"
+#include "bool.h"
 #include "buf.h"
 #include "buf_inspect.h"
 #include "buf_parse.h"
+#include "call.h"
+#include "cfn.h"
+#include "character.h"
 #include "env.h"
+#include "f32.h"
+#include "f64.h"
+#include "fact.h"
+#include "fn.h"
+#include "ident.h"
+#include "integer.h"
+#include "list.h"
+#include "ptag.h"
+#include "quote.h"
+#include "s8.h"
+#include "s16.h"
+#include "s32.h"
+#include "s64.h"
+#include "str.h"
+#include "sw.h"
 #include "sym.h"
 #include "tag.h"
+#include "tuple.h"
 #include "type.h"
+#include "u8.h"
+#include "u16.h"
+#include "u32.h"
+#include "u64.h"
+#include "uw.h"
+#include "var.h"
+
+bool array_copy_data (f_copy copy, const u8 *src, u8 *dest);
 
 void array_clean (s_array *a)
 {
@@ -41,12 +69,18 @@ void array_clean (s_array *a)
 
 s_array * array_copy (const s_array *src, s_array *dest)
 {
+  f_copy copy;
+  u8 *data_dest;
+  u8 *data_src;
   uw i = 0;
+  uw item_size;
+  s_array tmp;
   assert(dest);
   assert(src);
   assert(src->dimension);
   assert(src->dimensions);
   (void) i;
+  bzero(&tmp, sizeof(s_array));
   if (! src->dimension) {
     assert(! "array_copy: zero dimension");
     errx(1, "array_copy: zero dimension");
@@ -58,35 +92,48 @@ s_array * array_copy (const s_array *src, s_array *dest)
     i++;
   }
 #endif
-  dest->dimension = src->dimension;
-  if (! (dest->dimensions = calloc(src->dimension,
-                                   sizeof(s_array_dimension)))) {
+  tmp.dimension = src->dimension;
+  if (! (tmp.dimensions = calloc(src->dimension,
+                                 sizeof(s_array_dimension)))) {
     assert(! "array_copy: out of memory: dimensions");
     warnx("array_copy: out of memory: dimensions");
     return NULL;
   }
-  memcpy(dest->dimensions, src->dimensions,
+  memcpy(tmp.dimensions, src->dimensions,
          src->dimension * sizeof(s_array_dimension));
-  dest->count = src->count;
-  dest->size = src->size;
-  dest->type = src->type;
+  tmp.count = src->count;
+  tmp.size = src->size;
+  tmp.type = src->type;
   if (src->data) {
-    if (! (dest->data = calloc(1, src->size)))
+    if (! (tmp.data = calloc(1, src->size)))
       errx(1, "array_copy: out of memory");
-    memcpy(dest->data, src->data, dest->size);
+    copy = array_type_to_copy(src->type);
+    data_dest = tmp.data;
+    data_src = src->data;
+    i = 0;
+    item_size = src->dimensions[src->dimension - 1].item_size;
+    while (i < src->count) {
+      if (copy(data_src, data_dest) != data_dest) {
+        return NULL;
+      }
+      data_dest += item_size;
+      data_src += item_size;
+      i++;
+    }
   }
   else
-    dest->data = NULL;
+    tmp.data = NULL;
   if (src->tags) {
-    dest->tags = calloc(src->count, sizeof(s_tag));
+    tmp.tags = calloc(src->count, sizeof(s_tag));
     i = 0;
     while (i < src->count) {
-      tag_copy(src->tags + i, dest->tags + i);
+      tag_copy(src->tags + i, tmp.tags + i);
       i++;
     }
   }
   else
-    dest->tags = NULL;
+    tmp.tags = NULL;
+  *dest = tmp;
   return dest;
 }
 
@@ -131,6 +178,7 @@ s_tag * array_data_tag (s_tag *a, const s_tag *address, s_tag *dest)
 s_array * array_init (s_array *a, const s_sym *type, uw dimension,
                       const uw *dimensions)
 {
+  uw count = 1;
   uw i = 0;
   uw item_size;
   assert(a);
@@ -152,6 +200,7 @@ s_array * array_init (s_array *a, const s_sym *type, uw dimension,
   i = 0;
   while (i < dimension) {
     a->dimensions[i].count = dimensions[i];
+    count *= dimensions[i];
     i++;
   }
   i--;
@@ -164,7 +213,7 @@ s_array * array_init (s_array *a, const s_sym *type, uw dimension,
       a->dimensions[i + 1].item_size;
   }
   a->size = a->dimensions[0].count * a->dimensions[0].item_size;
-  a->count = a->size / item_size;
+  a->count = count;
   a->data = NULL;
   a->tags = NULL;
   return a;
@@ -397,6 +446,67 @@ f_buf_inspect_size array_type_to_buf_inspect_size (const s_sym *type)
   return NULL;
 }
 
+f_copy array_type_to_copy (const s_sym *type)
+{
+  if (type == sym_1("Bool"))
+    return (f_copy) bool_copy;
+  if (type == sym_1("Call"))
+    return (f_copy) call_copy;
+  if (type == sym_1("Cfn"))
+    return (f_copy) cfn_copy;
+  if (type == sym_1("Character"))
+    return (f_copy) character_copy;
+  if (type == sym_1("F32"))
+    return (f_copy) f32_copy;
+  if (type == sym_1("F64"))
+    return (f_copy) f64_copy;
+  if (type == sym_1("Fact"))
+    return (f_copy) fact_copy;
+  if (type == sym_1("Fn"))
+    return (f_copy) fn_copy;
+  if (type == sym_1("Ident"))
+    return (f_copy) ident_copy;
+  if (type == sym_1("Integer"))
+    return (f_copy) integer_copy;
+  if (type == sym_1("Sw"))
+    return (f_copy) sw_copy;
+  if (type == sym_1("S64"))
+    return (f_copy) s64_copy;
+  if (type == sym_1("S32"))
+    return (f_copy) s32_copy;
+  if (type == sym_1("S16"))
+    return (f_copy) s16_copy;
+  if (type == sym_1("S8"))
+    return (f_copy) s8_copy;
+  if (type == sym_1("U8"))
+    return (f_copy) u8_copy;
+  if (type == sym_1("U16"))
+    return (f_copy) u16_copy;
+  if (type == sym_1("U32"))
+    return (f_copy) u32_copy;
+  if (type == sym_1("U64"))
+    return (f_copy) u64_copy;
+  if (type == sym_1("Uw"))
+    return (f_copy) uw_copy;
+  if (type == sym_1("List"))
+    return (f_copy) list_copy;
+  if (type == sym_1("Ptag"))
+    return (f_copy) ptag_copy;
+  if (type == sym_1("Quote"))
+    return (f_copy) quote_copy;
+  if (type == sym_1("Str"))
+    return (f_copy) str_copy;
+  if (type == sym_1("Sym"))
+    return (f_copy) sym_copy;
+  if (type == sym_1("Tuple"))
+    return (f_copy) tuple_copy;
+  if (type == sym_1("Var"))
+    return (f_copy) var_copy;
+  assert(! "array_type_to_copy: unknown type");
+  errx(1, "array_type_to_copy: unknown type");
+  return NULL;
+}
+
 e_tag_type array_type_to_tag_type (const s_sym *type)
 {
   if (type == sym_1("Bool"))
diff --git a/libc3/array.h b/libc3/array.h
index c91970b..fdb2f52 100644
--- a/libc3/array.h
+++ b/libc3/array.h
@@ -27,6 +27,7 @@ s_tag *            array_data_tag (s_tag *a, const s_tag *address,
 uw                 array_type_size (const s_sym *type);
 f_buf_inspect      array_type_to_buf_inspect (const s_sym *type);
 f_buf_inspect_size array_type_to_buf_inspect_size (const s_sym *type);
+f_copy             array_type_to_copy (const s_sym *type);
 e_tag_type         array_type_to_tag_type (const s_sym *type);
 
 #endif /* ARRAY_H */
diff --git a/libc3/bool.c b/libc3/bool.c
index 9ad5136..83b8988 100644
--- a/libc3/bool.c
+++ b/libc3/bool.c
@@ -14,6 +14,12 @@
 #include "buf.h"
 #include "buf_inspect.h"
 
+bool *  bool_copy (const bool *src, bool *dest)
+{
+  *dest = *src;
+  return dest;
+}
+
 s_str * bool_inspect (bool *b, s_str *dest)
 {
   sw size;
diff --git a/libc3/bool.h b/libc3/bool.h
index ac65e0b..4cc307b 100644
--- a/libc3/bool.h
+++ b/libc3/bool.h
@@ -22,6 +22,7 @@
 #include "types.h"
 
 /* Observers */
+bool *  bool_copy (const bool *src, bool *dest);
 s_str * bool_inspect (bool *b, s_str *dest);
 
 #endif /* BOOL_H */
diff --git a/libc3/buf_parse.c b/libc3/buf_parse.c
index cf2abb2..720ba10 100644
--- a/libc3/buf_parse.c
+++ b/libc3/buf_parse.c
@@ -81,6 +81,7 @@ sw buf_parse_array (s_buf *buf, s_array *dest)
 sw buf_parse_array_data (s_buf *buf, s_array *dest)
 {
   uw *address;
+  uw i = 0;
   sw r;
   s_tag *tag;
   s_array tmp;
@@ -91,8 +92,12 @@ sw buf_parse_array_data (s_buf *buf, s_array *dest)
     warnx("buf_parse_array_data: out of memory: address");
     return -1;
   }
+  tmp.count = 1;
+  while (i < tmp.dimension) {
+    tmp.count *= tmp.dimensions[i].count;
+    i++;
+  }
   tmp.size = tmp.dimensions[0].count * tmp.dimensions[0].item_size;
-  tmp.count = tmp.size / tmp.dimensions[tmp.dimension - 1].item_size;
   assert(tmp.count);
   if (! (tmp.tags = calloc(tmp.count, sizeof(s_tag)))) {
     free(address);
@@ -389,11 +394,11 @@ sw buf_parse_bool (s_buf *buf, bool *p)
 
 sw buf_parse_brackets (s_buf *buf, s_call *dest)
 {
-  s_tag *arg_dimensions;
+  s_tag *arg_addr;
   uw d;
-  uw dimension = 0;
-  s_list *dimensions = NULL;
-  s_list **dimensions_last = &dimensions;
+  uw address = 0;
+  s_list *addr = NULL;
+  s_list **addr_last = &addr;
   sw r;
   sw result = 0;
   s_buf_save save;
@@ -404,7 +409,7 @@ sw buf_parse_brackets (s_buf *buf, s_call *dest)
   call_init(&tmp);
   ident_init(&tmp.ident, NULL, sym_1("[]"));
   tmp.arguments = list_new(NULL, list_new(NULL, NULL));
-  arg_dimensions = &(list_next(tmp.arguments)->tag);
+  arg_addr = &(list_next(tmp.arguments)->tag);
   if ((r = buf_parse_tag_primary(buf, &tmp.arguments->tag)) <= 0)
     goto restore;
   result += r;
@@ -426,16 +431,16 @@ sw buf_parse_brackets (s_buf *buf, s_call *dest)
     if ((r = buf_read_1(buf, "]")) <= 0)
       goto restore;
     result += r;
-    *dimensions_last = list_new(NULL, NULL);
-    tag_init_uw(&(*dimensions_last)->tag, d);
-    dimensions_last = &(*dimensions_last)->next.data.list;
-    dimension++;
+    *addr_last = list_new(NULL, NULL);
+    tag_init_uw(&(*addr_last)->tag, d);
+    addr_last = &(*addr_last)->next.data.list;
+    address++;
   }
-  if (! dimension) {
+  if (! address) {
     goto restore;
   }
-  arg_dimensions->type = TAG_ARRAY;
-  if (! list_to_array(dimensions, sym_1("Uw"), &arg_dimensions->data.array))
+  arg_addr->type = TAG_ARRAY;
+  if (! list_to_array(addr, sym_1("Uw"), &arg_addr->data.array))
     goto restore;
   *dest = tmp;
   r = result;
@@ -445,7 +450,7 @@ sw buf_parse_brackets (s_buf *buf, s_call *dest)
   buf_save_restore_rpos(buf, &save);
   call_clean(&tmp);
  clean:
-  list_delete_all(dimensions);
+  list_delete_all(addr);
   buf_save_clean(buf, &save);
   return r;
 }
diff --git a/libc3/cfn.c b/libc3/cfn.c
index 3dab138..dceb46d 100644
--- a/libc3/cfn.c
+++ b/libc3/cfn.c
@@ -44,9 +44,9 @@ s_tag * cfn_apply (s_cfn *cfn, s_list *args, s_tag *dest)
           arity, num_args);
     return NULL;
   }
-  cfn_tag_init(&tmp, cfn->result_type);
   if (cfn->arg_result)
     cfn_tag_init(&tmp2, cfn->result_type);
+  cfn_tag_init(&tmp, cfn->result_type);
   /* make result point to tmp value */
   result = tag_to_ffi_pointer(&tmp, cfn->result_type);
   if (cfn->arity) {
@@ -84,7 +84,6 @@ s_tag * cfn_apply (s_cfn *cfn, s_list *args, s_tag *dest)
     ffi_call(&cfn->cif, cfn->ptr.f, result, arg_values);
     if (cfn->arg_result) {
       *dest = tmp2;
-      tag_clean(&tmp);
     }
     else
       *dest = tmp;
diff --git a/libc3/character.c b/libc3/character.c
index db06e08..86db852 100644
--- a/libc3/character.c
+++ b/libc3/character.c
@@ -25,6 +25,14 @@ character character_1 (const s8 *p)
   return c;
 }
 
+character * character_copy (const character *src, character *dest)
+{
+  assert(src);
+  assert(dest);
+  *dest = *src;
+  return dest;
+}
+
 bool character_is_digit (character c)
 {
   return ('0' <= c && c <= '9');
diff --git a/libc3/character.h b/libc3/character.h
index fc4b87a..50743a1 100644
--- a/libc3/character.h
+++ b/libc3/character.h
@@ -16,19 +16,20 @@
 #include "hash.h"
 #include "types.h"
 
-character character_1 (const s8 *p);
-void      character_hash_update (character c, t_hash *hash);
-bool      character_is_digit (character c);
-bool      character_is_lowercase (character c);
-bool      character_is_printable (character c);
-bool      character_is_space (character c);
-bool      character_is_uppercase (character c);
-sw        character_read (s_buf *buf, character *c);
-character character_switch_case (character c);
-character character_to_lower (character c);
-character character_to_upper (character c);
-sw        character_write (s_buf *buf, character c);
-sw        character_utf8 (character c, s8 *dest);
-sw        character_utf8_size (character c);
+character   character_1 (const s8 *p);
+character * character_copy (const character *src, character *dest);
+void        character_hash_update (character c, t_hash *hash);
+bool        character_is_digit (character c);
+bool        character_is_lowercase (character c);
+bool        character_is_printable (character c);
+bool        character_is_space (character c);
+bool        character_is_uppercase (character c);
+sw          character_read (s_buf *buf, character *c);
+character   character_switch_case (character c);
+character   character_to_lower (character c);
+character   character_to_upper (character c);
+sw          character_write (s_buf *buf, character c);
+sw          character_utf8 (character c, s8 *dest);
+sw          character_utf8_size (character c);
 
 #endif /* CHARACTER_H */
diff --git a/libc3/env.c b/libc3/env.c
index 9ae581f..c11e962 100644
--- a/libc3/env.c
+++ b/libc3/env.c
@@ -108,6 +108,11 @@ bool env_eval_array (s_env *env, const s_array *array, s_array *dest)
   assert(dest);
   array_copy(array, &tmp);
   item_size = tmp.dimensions[tmp.dimension - 1].item_size;
+  if (tmp.data) {
+    *dest = tmp;
+    return true;
+  }
+  assert(array->tags);
   if (! tmp.data &&
       ! (tmp.data = calloc(tmp.dimensions[0].count,
                            tmp.dimensions[0].item_size))) {
@@ -131,17 +136,7 @@ bool env_eval_array (s_env *env, const s_array *array, s_array *dest)
   return true;
 }
 
-bool env_eval_array_tag (s_env *env, const s_array *array, s_tag *dest)
-{
-  s_array tmp;
-  if (! env_eval_array(env, array, &tmp))
-    return false;
-  dest->type = TAG_ARRAY;
-  dest->data.array = tmp;
-  return true;
-}
-
-bool env_eval_array_cast (s_env *env, s_array *tmp, const s_tag *tag,
+bool env_eval_array_cast (s_env *env, s_array *array, const s_tag *tag,
                           u8 *data, uw size)
 {
   s_call call;
@@ -149,17 +144,17 @@ bool env_eval_array_cast (s_env *env, s_array *tmp, const s_tag *tag,
   e_tag_type tag_type;
   void *data_eval;
   assert(env);
-  assert(tmp);
+  assert(array);
   assert(tag);
   assert(data);
   assert(size);
-  if (! call_init_cast(&call, tmp->type, tag))
+  if (! call_init_cast(&call, array->type, tag))
     return false;
   if (! env_eval_call(env, &call, &tag_eval)) {
     call_clean(&call);
     return false;
   }
-  tag_type = array_type_to_tag_type(tmp->type);
+  tag_type = array_type_to_tag_type(array->type);
   data_eval = tag_to_pointer(&tag_eval, tag_type);
   memcpy(data, data_eval, size);
   call_clean(&call);
@@ -167,6 +162,16 @@ bool env_eval_array_cast (s_env *env, s_array *tmp, const s_tag *tag,
   return true;
 }
 
+bool env_eval_array_tag (s_env *env, const s_array *array, s_tag *dest)
+{
+  s_array tmp;
+  if (! env_eval_array(env, array, &tmp))
+    return false;
+  dest->type = TAG_ARRAY;
+  dest->data.array = tmp;
+  return true;
+}
+
 bool env_eval_call (s_env *env, const s_call *call, s_tag *dest)
 {
   s_call c;
diff --git a/libc3/f32.c b/libc3/f32.c
new file mode 100644
index 0000000..85fef64
--- /dev/null
+++ b/libc3/f32.c
@@ -0,0 +1,88 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+#include <assert.h>
+#include <err.h>
+#include "integer.h"
+#include "tag.h"
+#include "f32.h"
+
+f32 f32_cast (s_tag *tag)
+{
+  switch (tag->type) {
+  case TAG_VOID:
+    return 0;
+  case TAG_ARRAY:
+    goto ko;
+  case TAG_BOOL:
+    return tag->data.bool ? 1 : 0;
+  case TAG_CALL:
+    goto ko;
+  case TAG_CFN:
+    goto ko;
+  case TAG_CHARACTER:
+    return (f32) tag->data.character;
+  case TAG_F32:
+    return (f32) tag->data.f32;
+  case TAG_F64:
+    return (f32) tag->data.f64;
+  case TAG_FACT:
+  case TAG_FN:
+  case TAG_IDENT:
+    goto ko;
+  case TAG_INTEGER:
+    return integer_to_f32(&tag->data.integer);
+  case TAG_SW:
+    return (f32) tag->data.sw;
+  case TAG_S64:
+    return (f32) tag->data.s64;
+  case TAG_S32:
+    return (f32) tag->data.s32;
+  case TAG_S16:
+    return (f32) tag->data.s16;
+  case TAG_S8:
+    return (f32) tag->data.s8;
+  case TAG_U8:
+    return (f32) tag->data.u8;
+  case TAG_U16:
+    return (f32) tag->data.u16;
+  case TAG_U32:
+    return (f32) tag->data.u32;
+  case TAG_U64:
+    return (f32) tag->data.u64;
+  case TAG_UW:
+    return (f32) tag->data.uw;
+  case TAG_LIST:
+  case TAG_PTAG:
+  case TAG_QUOTE:
+  case TAG_STR:
+  case TAG_SYM:
+  case TAG_TUPLE:
+  case TAG_VAR:
+    goto ko;
+  }
+  assert(! "f32_cast: unknown tag type");
+  errx(1, "f32_cast: unknown tag type: %d", tag->type);
+  return 0;
+ ko:
+  warnx("f32_cast: cannot cast %s to f32",
+        tag_type_to_sym(tag->type)->str.ptr.ps8);
+  return 0;
+}
+
+f32 * f32_copy (const f32 *src, f32 *dest)
+{
+  assert(src);
+  assert(dest);
+  *dest = *src;
+  return dest;
+}
diff --git a/libc3/f32.h b/libc3/f32.h
new file mode 100644
index 0000000..08f692c
--- /dev/null
+++ b/libc3/f32.h
@@ -0,0 +1,21 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+#ifndef F32_H
+#define F32_H
+
+#include "types.h"
+
+f32 f32_cast (s_tag *tag);
+f32 * f32_copy (const f32 *src, f32 *dest);
+
+#endif /* F32_H */
diff --git a/libc3/f64.c b/libc3/f64.c
new file mode 100644
index 0000000..02e5e1b
--- /dev/null
+++ b/libc3/f64.c
@@ -0,0 +1,88 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+#include <assert.h>
+#include <err.h>
+#include "integer.h"
+#include "tag.h"
+#include "f64.h"
+
+f64 f64_cast (s_tag *tag)
+{
+  switch (tag->type) {
+  case TAG_VOID:
+    return 0;
+  case TAG_ARRAY:
+    goto ko;
+  case TAG_BOOL:
+    return tag->data.bool ? 1 : 0;
+  case TAG_CALL:
+    goto ko;
+  case TAG_CFN:
+    goto ko;
+  case TAG_CHARACTER:
+    return (f64) tag->data.character;
+  case TAG_F32:
+    return (f64) tag->data.f32;
+  case TAG_F64:
+    return (f64) tag->data.f64;
+  case TAG_FACT:
+  case TAG_FN:
+  case TAG_IDENT:
+    goto ko;
+  case TAG_INTEGER:
+    return integer_to_f64(&tag->data.integer);
+  case TAG_SW:
+    return (f64) tag->data.sw;
+  case TAG_S64:
+    return (f64) tag->data.s64;
+  case TAG_S32:
+    return (f64) tag->data.s32;
+  case TAG_S16:
+    return (f64) tag->data.s16;
+  case TAG_S8:
+    return (f64) tag->data.s8;
+  case TAG_U8:
+    return (f64) tag->data.u8;
+  case TAG_U16:
+    return (f64) tag->data.u16;
+  case TAG_U32:
+    return (f64) tag->data.u32;
+  case TAG_U64:
+    return (f64) tag->data.u64;
+  case TAG_UW:
+    return (f64) tag->data.uw;
+  case TAG_LIST:
+  case TAG_PTAG:
+  case TAG_QUOTE:
+  case TAG_STR:
+  case TAG_SYM:
+  case TAG_TUPLE:
+  case TAG_VAR:
+    goto ko;
+  }
+  assert(! "f64_cast: unknown tag type");
+  errx(1, "f64_cast: unknown tag type: %d", tag->type);
+  return 0;
+ ko:
+  warnx("f64_cast: cannot cast %s to f64",
+        tag_type_to_sym(tag->type)->str.ptr.ps8);
+  return 0;
+}
+
+f64 * f64_copy (const f64 *src, f64 *dest)
+{
+  assert(src);
+  assert(dest);
+  *dest = *src;
+  return dest;
+}
diff --git a/libc3/f64.h b/libc3/f64.h
new file mode 100644
index 0000000..2158d7a
--- /dev/null
+++ b/libc3/f64.h
@@ -0,0 +1,21 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+#ifndef F64_H
+#define F64_H
+
+#include "types.h"
+
+f64 f64_cast (s_tag *tag);
+f64 * f64_copy (const f64 *src, f64 *dest);
+
+#endif /* F64_H */
diff --git a/libc3/integer.c b/libc3/integer.c
index ee02546..593d49e 100644
--- a/libc3/integer.c
+++ b/libc3/integer.c
@@ -177,7 +177,7 @@ s_integer * integer_copy (const s_integer *a, s_integer *dest)
   sw r;
   assert(a);
   assert(dest);
-  if ((r = mp_copy(&a->mp_int, &dest->mp_int)) != MP_OKAY)
+  if ((r = mp_init_copy(&dest->mp_int, &a->mp_int)) != MP_OKAY)
     errx(1, "integer_copy: %s", mp_error_to_string(r));
   return dest;
 }
@@ -493,6 +493,12 @@ s_integer * integer_sub (const s_integer *a, const s_integer *b,
   return dest;
 }
 
+f32 integer_to_f32 (const s_integer *i)
+{
+  assert(i);
+  return (f32) mp_get_double(&i->mp_int);
+}
+
 f64 integer_to_f64 (const s_integer *i)
 {
   assert(i);
diff --git a/libc3/integer.h b/libc3/integer.h
index 151509d..74d6c80 100644
--- a/libc3/integer.h
+++ b/libc3/integer.h
@@ -93,6 +93,7 @@ uw   integer_bits (const s_integer *i);
 uw   integer_bytes (const s_integer *i);
 bool integer_is_negative (const s_integer *i);
 bool integer_is_zero (const s_integer *i);
+f32  integer_to_f32 (const s_integer *i);
 f64  integer_to_f64 (const s_integer *i);
 s8   integer_to_s8 (const s_integer *i);
 s16  integer_to_s16 (const s_integer *i);
diff --git a/libc3/list.c b/libc3/list.c
index 8adee3a..474ab99 100644
--- a/libc3/list.c
+++ b/libc3/list.c
@@ -144,6 +144,7 @@ s_list * list_new (const s_tag *tag, s_list *next)
 s_array * list_to_array (s_list *list, const s_sym *type,
                          s_array *dest)
 {
+  f_copy copy;
   s8 *data;
   void *data_list;
   s_list *l;
@@ -157,15 +158,17 @@ s_array * list_to_array (s_list *list, const s_sym *type,
   dest->type = type;
   if (! (dest->dimensions = calloc(1, sizeof(s_array_dimension))))
     errx(1, "list_to_array: out of memory: 1");
+  dest->count = len;
   dest->dimensions[0].count = len;
   dest->dimensions[0].item_size = size;
   dest->size = len * size;
   if (! (data = dest->data = calloc(len, size)))
     errx(1, "list_to_array: out of memory: 2");
+  copy = array_type_to_copy(type);
   l = list;
   while (l) {
     data_list = tag_to_pointer(&l->tag, array_type_to_tag_type(type));
-    memcpy(data, data_list, size);
+    copy(data_list, data);
     data += size;
     l = list_next(l);
   }
diff --git a/libc3/ptag.c b/libc3/ptag.c
new file mode 100644
index 0000000..cdcfb14
--- /dev/null
+++ b/libc3/ptag.c
@@ -0,0 +1,23 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+#include <assert.h>
+#include <err.h>
+#include "ptag.h"
+
+p_tag * ptag_copy (const p_tag *src, p_tag *dest)
+{
+  assert(src);
+  assert(dest);
+  *dest = *src;
+  return dest;
+}
diff --git a/libc3/ptag.h b/libc3/ptag.h
new file mode 100644
index 0000000..1ea09a7
--- /dev/null
+++ b/libc3/ptag.h
@@ -0,0 +1,20 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+#ifndef PTAG_H
+#define PTAG_H
+
+#include "types.h"
+
+p_tag * ptag_copy (const p_tag *src, p_tag *dest);
+
+#endif /* PTAG_H */
diff --git a/libc3/s.c.in b/libc3/s.c.in
index 1c4eabb..44a9c81 100644
--- a/libc3/s.c.in
+++ b/libc3/s.c.in
@@ -79,3 +79,11 @@ s_bits$ s_bits$_cast (s_tag *tag)
         tag_type_to_sym(tag->type)->str.ptr.ps8);
   return 0;
 }
+
+s_bits$ * s_bits$_copy (const s_bits$ *src, s_bits$ *dest)
+{
+  assert(src);
+  assert(dest);
+  *dest = *src;
+  return dest;
+}
diff --git a/libc3/s.h.in b/libc3/s.h.in
index 0363f1d..074eca2 100644
--- a/libc3/s.h.in
+++ b/libc3/s.h.in
@@ -16,6 +16,7 @@
 
 #include "types.h"
 
-s_bits$ s_bits$_cast (s_tag *tag);
+s_bits$   s_bits$_cast (s_tag *tag);
+s_bits$ * s_bits$_copy (const s_bits$ *src, s_bits$ *dest);
 
 #endif /* S8_H */
diff --git a/libc3/s16.c b/libc3/s16.c
index 9786a64..e0d1301 100644
--- a/libc3/s16.c
+++ b/libc3/s16.c
@@ -79,3 +79,11 @@ s16 s16_cast (s_tag *tag)
         tag_type_to_sym(tag->type)->str.ptr.ps8);
   return 0;
 }
+
+s16 * s16_copy (const s16 *src, s16 *dest)
+{
+  assert(src);
+  assert(dest);
+  *dest = *src;
+  return dest;
+}
diff --git a/libc3/s16.h b/libc3/s16.h
index 8eaf64e..7385b59 100644
--- a/libc3/s16.h
+++ b/libc3/s16.h
@@ -16,6 +16,7 @@
 
 #include "types.h"
 
-s16 s16_cast (s_tag *tag);
+s16   s16_cast (s_tag *tag);
+s16 * s16_copy (const s16 *src, s16 *dest);
 
 #endif /* S8_H */
diff --git a/libc3/s32.c b/libc3/s32.c
index 989a9ec..38022e3 100644
--- a/libc3/s32.c
+++ b/libc3/s32.c
@@ -79,3 +79,11 @@ s32 s32_cast (s_tag *tag)
         tag_type_to_sym(tag->type)->str.ptr.ps8);
   return 0;
 }
+
+s32 * s32_copy (const s32 *src, s32 *dest)
+{
+  assert(src);
+  assert(dest);
+  *dest = *src;
+  return dest;
+}
diff --git a/libc3/s32.h b/libc3/s32.h
index 7f82bb7..bf99894 100644
--- a/libc3/s32.h
+++ b/libc3/s32.h
@@ -16,6 +16,7 @@
 
 #include "types.h"
 
-s32 s32_cast (s_tag *tag);
+s32   s32_cast (s_tag *tag);
+s32 * s32_copy (const s32 *src, s32 *dest);
 
 #endif /* S8_H */
diff --git a/libc3/s64.c b/libc3/s64.c
index fc00a34..222e464 100644
--- a/libc3/s64.c
+++ b/libc3/s64.c
@@ -79,3 +79,11 @@ s64 s64_cast (s_tag *tag)
         tag_type_to_sym(tag->type)->str.ptr.ps8);
   return 0;
 }
+
+s64 * s64_copy (const s64 *src, s64 *dest)
+{
+  assert(src);
+  assert(dest);
+  *dest = *src;
+  return dest;
+}
diff --git a/libc3/s64.h b/libc3/s64.h
index b1d1af7..2b48859 100644
--- a/libc3/s64.h
+++ b/libc3/s64.h
@@ -16,6 +16,7 @@
 
 #include "types.h"
 
-s64 s64_cast (s_tag *tag);
+s64   s64_cast (s_tag *tag);
+s64 * s64_copy (const s64 *src, s64 *dest);
 
 #endif /* S8_H */
diff --git a/libc3/s8.c b/libc3/s8.c
index b0b3b85..4f5057b 100644
--- a/libc3/s8.c
+++ b/libc3/s8.c
@@ -79,3 +79,11 @@ s8 s8_cast (s_tag *tag)
         tag_type_to_sym(tag->type)->str.ptr.ps8);
   return 0;
 }
+
+s8 * s8_copy (const s8 *src, s8 *dest)
+{
+  assert(src);
+  assert(dest);
+  *dest = *src;
+  return dest;
+}
diff --git a/libc3/s8.h b/libc3/s8.h
index c869234..7d6f3da 100644
--- a/libc3/s8.h
+++ b/libc3/s8.h
@@ -16,6 +16,7 @@
 
 #include "types.h"
 
-s8 s8_cast (s_tag *tag);
+s8   s8_cast (s_tag *tag);
+s8 * s8_copy (const s8 *src, s8 *dest);
 
 #endif /* S8_H */
diff --git a/libc3/sources.mk b/libc3/sources.mk
index a4a1a18..c87fc5e 100644
--- a/libc3/sources.mk
+++ b/libc3/sources.mk
@@ -84,6 +84,8 @@ HEADERS = \
 	error.h \
 	error_handler.h \
 	eval.h \
+	f32.h \
+	f64.h \
 	fact.h \
 	facts.h \
 	facts_cursor.h \
@@ -104,6 +106,7 @@ HEADERS = \
 	log.h \
 	module.h \
 	operator.h \
+	ptag.h \
 	quote.h \
 	s16.h \
 	s32.h \
@@ -133,6 +136,7 @@ HEADERS = \
 	u8.h \
 	ucd.h \
 	uw.h \
+	var.h \
 
 SOURCES = \
 	abs.c \
@@ -216,6 +220,8 @@ SOURCES = \
 	error.c \
 	error_handler.c \
 	eval.c \
+	f32.c \
+	f64.c \
 	fact.c \
 	facts.c \
 	facts_cursor.c \
@@ -235,6 +241,7 @@ SOURCES = \
 	log.c \
 	module.c \
 	operator.c \
+	ptag.c \
 	quote.c \
 	s16.c \
 	s32.c \
@@ -262,6 +269,7 @@ SOURCES = \
 	u8.c \
 	ucd.c \
 	uw.c \
+	var.c \
 
 LO_SOURCES = \
 	abs.c \
@@ -345,6 +353,8 @@ LO_SOURCES = \
 	error.c \
 	error_handler.c \
 	eval.c \
+	f32.c \
+	f64.c \
 	fact.c \
 	facts.c \
 	facts_cursor.c \
@@ -364,6 +374,7 @@ LO_SOURCES = \
 	log.c \
 	module.c \
 	operator.c \
+	ptag.c \
 	quote.c \
 	s16.c \
 	s32.c \
@@ -391,6 +402,7 @@ LO_SOURCES = \
 	u8.c \
 	ucd.c \
 	uw.c \
+	var.c \
 	../libtommath/bn_cutoffs.c \
 	../libtommath/bn_mp_2expt.c \
 	../libtommath/bn_mp_abs.c \
diff --git a/libc3/sources.sh b/libc3/sources.sh
index c7a5b1b..894d3dd 100644
--- a/libc3/sources.sh
+++ b/libc3/sources.sh
@@ -1,4 +1,4 @@
 # sources.sh generated by update_sources
-HEADERS='abs.h arg.h array.h binding.h bool.h buf.h buf_file.h buf_inspect.h buf_inspect_s16.h buf_inspect_s16_binary.h buf_inspect_s16_decimal.h buf_inspect_s16_hexadecimal.h buf_inspect_s16_octal.h buf_inspect_s32.h buf_inspect_s32_binary.h buf_inspect_s32_decimal.h buf_inspect_s32_hexadecimal.h buf_inspect_s32_octal.h buf_inspect_s64.h buf_inspect_s64_binary.h buf_inspect_s64_decimal.h buf_inspect_s64_hexadecimal.h buf_inspect_s64_octal.h buf_inspect_s8.h buf_inspect_s8_binary.h buf_inspect_s8_decimal.h buf_inspect_s8_hexadecimal.h buf_inspect_s8_octal.h buf_inspect_sw.h buf_inspect_sw_binary.h buf_inspect_sw_decimal.h buf_inspect_sw_hexadecimal.h buf_inspect_sw_octal.h buf_inspect_u16.h buf_inspect_u16_binary.h buf_inspect_u16_decimal.h buf_inspect_u16_hexadecimal.h buf_inspect_u16_octal.h buf_inspect_u32.h buf_inspect_u32_binary.h buf_inspect_u32_decimal.h buf_inspect_u32_hexadecimal.h buf_inspect_u32_octal.h buf_inspect_u64.h buf_inspect_u64_binary.h buf_inspect_u64_decimal.h buf_inspect_u64_hexadecimal.h buf_inspect_u64_octal.h buf_inspect_u8.h buf_inspect_u8_binary.h buf_inspect_u8_decimal.h buf_inspect_u8_hexadecimal.h buf_inspect_u8_octal.h buf_inspect_uw.h buf_inspect_uw_binary.h buf_inspect_uw_decimal.h buf_inspect_uw_hexadecimal.h buf_inspect_uw_octal.h buf_parse.h buf_parse_c.h buf_parse_s16.h buf_parse_s32.h buf_parse_s64.h buf_parse_s8.h buf_parse_sw.h buf_parse_u16.h buf_parse_u32.h buf_parse_u64.h buf_parse_u8.h buf_parse_uw.h buf_save.h c3.h c3_main.h c_types.h call.h ceiling.h cfn.h character.h compare.h config.h env.h error.h error_handler.h eval.h fact.h facts.h facts_cursor.h facts_spec.h facts_spec_cursor.h facts_with.h facts_with_cursor.h file.h float.h fn.h fn_clause.h frame.h hash.h ident.h integer.h io.h list.h log.h module.h operator.h quote.h s16.h s32.h s64.h s8.h set__fact.h set__tag.h set_cursor__fact.h set_cursor__tag.h set_item__fact.h set_item__tag.h sha1.h sign.h skiplist__fact.h skiplist_node__fact.h str.h sw.h sym.h tag.h timespec.h tuple.h type.h types.h u16.h u32.h u64.h u8.h ucd.h uw.h '
-SOURCES='abs.c arg.c array.c binding.c bool.c buf.c buf_file.c buf_inspect.c buf_inspect_s16.c buf_inspect_s16_binary.c buf_inspect_s16_decimal.c buf_inspect_s16_hexadecimal.c buf_inspect_s16_octal.c buf_inspect_s32.c buf_inspect_s32_binary.c buf_inspect_s32_decimal.c buf_inspect_s32_hexadecimal.c buf_inspect_s32_octal.c buf_inspect_s64.c buf_inspect_s64_binary.c buf_inspect_s64_decimal.c buf_inspect_s64_hexadecimal.c buf_inspect_s64_octal.c buf_inspect_s8.c buf_inspect_s8_binary.c buf_inspect_s8_decimal.c buf_inspect_s8_hexadecimal.c buf_inspect_s8_octal.c buf_inspect_sw.c buf_inspect_sw_binary.c buf_inspect_sw_decimal.c buf_inspect_sw_hexadecimal.c buf_inspect_sw_octal.c buf_inspect_u16.c buf_inspect_u16_binary.c buf_inspect_u16_decimal.c buf_inspect_u16_hexadecimal.c buf_inspect_u16_octal.c buf_inspect_u32.c buf_inspect_u32_binary.c buf_inspect_u32_decimal.c buf_inspect_u32_hexadecimal.c buf_inspect_u32_octal.c buf_inspect_u64.c buf_inspect_u64_binary.c buf_inspect_u64_decimal.c buf_inspect_u64_hexadecimal.c buf_inspect_u64_octal.c buf_inspect_u8.c buf_inspect_u8_binary.c buf_inspect_u8_decimal.c buf_inspect_u8_hexadecimal.c buf_inspect_u8_octal.c buf_inspect_uw.c buf_inspect_uw_binary.c buf_inspect_uw_decimal.c buf_inspect_uw_hexadecimal.c buf_inspect_uw_octal.c buf_parse.c buf_parse_c.c buf_parse_s16.c buf_parse_s32.c buf_parse_s64.c buf_parse_s8.c buf_parse_sw.c buf_parse_u16.c buf_parse_u32.c buf_parse_u64.c buf_parse_u8.c buf_parse_uw.c buf_save.c c3.c call.c ceiling.c cfn.c character.c compare.c env.c error.c error_handler.c eval.c fact.c facts.c facts_cursor.c facts_spec.c facts_spec_cursor.c facts_with.c facts_with_cursor.c file.c fn.c fn_clause.c frame.c hash.c ident.c integer.c io.c list.c log.c module.c operator.c quote.c s16.c s32.c s64.c s8.c set__fact.c set__tag.c set_cursor__fact.c set_cursor__tag.c set_item__fact.c set_item__tag.c sign.c skiplist__fact.c skiplist_node__fact.c str.c sw.c sym.c tag.c timespec.c tuple.c type.c u16.c u32.c u64.c u8.c ucd.c uw.c '
-LO_SOURCES='abs.c arg.c array.c binding.c bool.c buf.c buf_file.c buf_inspect.c buf_inspect_s16.c buf_inspect_s16_binary.c buf_inspect_s16_decimal.c buf_inspect_s16_hexadecimal.c buf_inspect_s16_octal.c buf_inspect_s32.c buf_inspect_s32_binary.c buf_inspect_s32_decimal.c buf_inspect_s32_hexadecimal.c buf_inspect_s32_octal.c buf_inspect_s64.c buf_inspect_s64_binary.c buf_inspect_s64_decimal.c buf_inspect_s64_hexadecimal.c buf_inspect_s64_octal.c buf_inspect_s8.c buf_inspect_s8_binary.c buf_inspect_s8_decimal.c buf_inspect_s8_hexadecimal.c buf_inspect_s8_octal.c buf_inspect_sw.c buf_inspect_sw_binary.c buf_inspect_sw_decimal.c buf_inspect_sw_hexadecimal.c buf_inspect_sw_octal.c buf_inspect_u16.c buf_inspect_u16_binary.c buf_inspect_u16_decimal.c buf_inspect_u16_hexadecimal.c buf_inspect_u16_octal.c buf_inspect_u32.c buf_inspect_u32_binary.c buf_inspect_u32_decimal.c buf_inspect_u32_hexadecimal.c buf_inspect_u32_octal.c buf_inspect_u64.c buf_inspect_u64_binary.c buf_inspect_u64_decimal.c buf_inspect_u64_hexadecimal.c buf_inspect_u64_octal.c buf_inspect_u8.c buf_inspect_u8_binary.c buf_inspect_u8_decimal.c buf_inspect_u8_hexadecimal.c buf_inspect_u8_octal.c buf_inspect_uw.c buf_inspect_uw_binary.c buf_inspect_uw_decimal.c buf_inspect_uw_hexadecimal.c buf_inspect_uw_octal.c buf_parse.c buf_parse_c.c buf_parse_s16.c buf_parse_s32.c buf_parse_s64.c buf_parse_s8.c buf_parse_sw.c buf_parse_u16.c buf_parse_u32.c buf_parse_u64.c buf_parse_u8.c buf_parse_uw.c buf_save.c c3.c call.c ceiling.c cfn.c character.c compare.c env.c error.c error_handler.c eval.c fact.c facts.c facts_cursor.c facts_spec.c facts_spec_cursor.c facts_with.c facts_with_cursor.c file.c fn.c fn_clause.c frame.c hash.c ident.c integer.c io.c list.c log.c module.c operator.c quote.c s16.c s32.c s64.c s8.c set__fact.c set__tag.c set_cursor__fact.c set_cursor__tag.c set_item__fact.c set_item__tag.c sign.c skiplist__fact.c skiplist_node__fact.c str.c sw.c sym.c tag.c timespec.c tuple.c type.c u16.c u32.c u64.c u8.c ucd.c uw.c ../libtommath/bn_cutoffs.c ../libtommath/bn_mp_2expt.c ../libtommath/bn_mp_abs.c ../libtommath/bn_mp_add.c ../libtommath/bn_mp_add_d.c ../libtommath/bn_mp_and.c ../libtommath/bn_mp_clamp.c ../libtommath/bn_mp_clear.c ../libtommath/bn_mp_clear_multi.c ../libtommath/bn_mp_cmp.c ../libtommath/bn_mp_cmp_d.c ../libtommath/bn_mp_cmp_mag.c ../libtommath/bn_mp_cnt_lsb.c ../libtommath/bn_mp_complement.c ../libtommath/bn_mp_copy.c ../libtommath/bn_mp_count_bits.c ../libtommath/bn_mp_div.c ../libtommath/bn_mp_div_2.c ../libtommath/bn_mp_div_2d.c ../libtommath/bn_mp_div_3.c ../libtommath/bn_mp_div_d.c ../libtommath/bn_mp_dr_is_modulus.c ../libtommath/bn_mp_dr_reduce.c ../libtommath/bn_mp_dr_setup.c ../libtommath/bn_mp_error_to_string.c ../libtommath/bn_mp_exch.c ../libtommath/bn_mp_exptmod.c ../libtommath/bn_mp_gcd.c ../libtommath/bn_mp_get_double.c ../libtommath/bn_mp_get_i32.c ../libtommath/bn_mp_get_i64.c ../libtommath/bn_mp_get_mag_u32.c ../libtommath/bn_mp_get_mag_u64.c ../libtommath/bn_mp_grow.c ../libtommath/bn_mp_init.c ../libtommath/bn_mp_init_copy.c ../libtommath/bn_mp_init_multi.c ../libtommath/bn_mp_init_size.c ../libtommath/bn_mp_invmod.c ../libtommath/bn_mp_lcm.c ../libtommath/bn_mp_lshd.c ../libtommath/bn_mp_mod.c ../libtommath/bn_mp_mod_2d.c ../libtommath/bn_mp_montgomery_calc_normalization.c ../libtommath/bn_mp_montgomery_reduce.c ../libtommath/bn_mp_montgomery_setup.c ../libtommath/bn_mp_mul.c ../libtommath/bn_mp_mul_2.c ../libtommath/bn_mp_mul_2d.c ../libtommath/bn_mp_mul_d.c ../libtommath/bn_mp_mulmod.c ../libtommath/bn_mp_neg.c ../libtommath/bn_mp_or.c ../libtommath/bn_mp_radix_size.c ../libtommath/bn_mp_reduce.c ../libtommath/bn_mp_reduce_2k.c ../libtommath/bn_mp_reduce_2k_l.c ../libtommath/bn_mp_reduce_2k_setup.c ../libtommath/bn_mp_reduce_2k_setup_l.c ../libtommath/bn_mp_reduce_is_2k.c ../libtommath/bn_mp_reduce_is_2k_l.c ../libtommath/bn_mp_reduce_setup.c ../libtommath/bn_mp_rshd.c ../libtommath/bn_mp_set.c ../libtommath/bn_mp_set_double.c ../libtommath/bn_mp_set_i32.c ../libtommath/bn_mp_set_i64.c ../libtommath/bn_mp_set_l.c ../libtommath/bn_mp_set_u32.c ../libtommath/bn_mp_set_u64.c ../libtommath/bn_mp_set_ul.c ../libtommath/bn_mp_sqr.c ../libtommath/bn_mp_sqrt.c ../libtommath/bn_mp_sub.c ../libtommath/bn_mp_sub_d.c ../libtommath/bn_mp_xor.c ../libtommath/bn_mp_zero.c ../libtommath/bn_s_mp_add.c ../libtommath/bn_s_mp_balance_mul.c ../libtommath/bn_s_mp_exptmod.c ../libtommath/bn_s_mp_exptmod_fast.c ../libtommath/bn_s_mp_invmod_fast.c ../libtommath/bn_s_mp_invmod_slow.c ../libtommath/bn_s_mp_karatsuba_mul.c ../libtommath/bn_s_mp_karatsuba_sqr.c ../libtommath/bn_s_mp_montgomery_reduce_fast.c ../libtommath/bn_s_mp_mul_digs.c ../libtommath/bn_s_mp_mul_digs_fast.c ../libtommath/bn_s_mp_mul_high_digs.c ../libtommath/bn_s_mp_mul_high_digs_fast.c ../libtommath/bn_s_mp_rand_platform.c ../libtommath/bn_s_mp_sqr.c ../libtommath/bn_s_mp_sqr_fast.c ../libtommath/bn_s_mp_sub.c ../libtommath/bn_s_mp_toom_mul.c ../libtommath/bn_s_mp_toom_sqr.c  '
+HEADERS='abs.h arg.h array.h binding.h bool.h buf.h buf_file.h buf_inspect.h buf_inspect_s16.h buf_inspect_s16_binary.h buf_inspect_s16_decimal.h buf_inspect_s16_hexadecimal.h buf_inspect_s16_octal.h buf_inspect_s32.h buf_inspect_s32_binary.h buf_inspect_s32_decimal.h buf_inspect_s32_hexadecimal.h buf_inspect_s32_octal.h buf_inspect_s64.h buf_inspect_s64_binary.h buf_inspect_s64_decimal.h buf_inspect_s64_hexadecimal.h buf_inspect_s64_octal.h buf_inspect_s8.h buf_inspect_s8_binary.h buf_inspect_s8_decimal.h buf_inspect_s8_hexadecimal.h buf_inspect_s8_octal.h buf_inspect_sw.h buf_inspect_sw_binary.h buf_inspect_sw_decimal.h buf_inspect_sw_hexadecimal.h buf_inspect_sw_octal.h buf_inspect_u16.h buf_inspect_u16_binary.h buf_inspect_u16_decimal.h buf_inspect_u16_hexadecimal.h buf_inspect_u16_octal.h buf_inspect_u32.h buf_inspect_u32_binary.h buf_inspect_u32_decimal.h buf_inspect_u32_hexadecimal.h buf_inspect_u32_octal.h buf_inspect_u64.h buf_inspect_u64_binary.h buf_inspect_u64_decimal.h buf_inspect_u64_hexadecimal.h buf_inspect_u64_octal.h buf_inspect_u8.h buf_inspect_u8_binary.h buf_inspect_u8_decimal.h buf_inspect_u8_hexadecimal.h buf_inspect_u8_octal.h buf_inspect_uw.h buf_inspect_uw_binary.h buf_inspect_uw_decimal.h buf_inspect_uw_hexadecimal.h buf_inspect_uw_octal.h buf_parse.h buf_parse_c.h buf_parse_s16.h buf_parse_s32.h buf_parse_s64.h buf_parse_s8.h buf_parse_sw.h buf_parse_u16.h buf_parse_u32.h buf_parse_u64.h buf_parse_u8.h buf_parse_uw.h buf_save.h c3.h c3_main.h c_types.h call.h ceiling.h cfn.h character.h compare.h config.h env.h error.h error_handler.h eval.h f32.h f64.h fact.h facts.h facts_cursor.h facts_spec.h facts_spec_cursor.h facts_with.h facts_with_cursor.h file.h float.h fn.h fn_clause.h frame.h hash.h ident.h integer.h io.h list.h log.h module.h operator.h ptag.h quote.h s16.h s32.h s64.h s8.h set__fact.h set__tag.h set_cursor__fact.h set_cursor__tag.h set_item__fact.h set_item__tag.h sha1.h sign.h skiplist__fact.h skiplist_node__fact.h str.h sw.h sym.h tag.h timespec.h tuple.h type.h types.h u16.h u32.h u64.h u8.h ucd.h uw.h var.h '
+SOURCES='abs.c arg.c array.c binding.c bool.c buf.c buf_file.c buf_inspect.c buf_inspect_s16.c buf_inspect_s16_binary.c buf_inspect_s16_decimal.c buf_inspect_s16_hexadecimal.c buf_inspect_s16_octal.c buf_inspect_s32.c buf_inspect_s32_binary.c buf_inspect_s32_decimal.c buf_inspect_s32_hexadecimal.c buf_inspect_s32_octal.c buf_inspect_s64.c buf_inspect_s64_binary.c buf_inspect_s64_decimal.c buf_inspect_s64_hexadecimal.c buf_inspect_s64_octal.c buf_inspect_s8.c buf_inspect_s8_binary.c buf_inspect_s8_decimal.c buf_inspect_s8_hexadecimal.c buf_inspect_s8_octal.c buf_inspect_sw.c buf_inspect_sw_binary.c buf_inspect_sw_decimal.c buf_inspect_sw_hexadecimal.c buf_inspect_sw_octal.c buf_inspect_u16.c buf_inspect_u16_binary.c buf_inspect_u16_decimal.c buf_inspect_u16_hexadecimal.c buf_inspect_u16_octal.c buf_inspect_u32.c buf_inspect_u32_binary.c buf_inspect_u32_decimal.c buf_inspect_u32_hexadecimal.c buf_inspect_u32_octal.c buf_inspect_u64.c buf_inspect_u64_binary.c buf_inspect_u64_decimal.c buf_inspect_u64_hexadecimal.c buf_inspect_u64_octal.c buf_inspect_u8.c buf_inspect_u8_binary.c buf_inspect_u8_decimal.c buf_inspect_u8_hexadecimal.c buf_inspect_u8_octal.c buf_inspect_uw.c buf_inspect_uw_binary.c buf_inspect_uw_decimal.c buf_inspect_uw_hexadecimal.c buf_inspect_uw_octal.c buf_parse.c buf_parse_c.c buf_parse_s16.c buf_parse_s32.c buf_parse_s64.c buf_parse_s8.c buf_parse_sw.c buf_parse_u16.c buf_parse_u32.c buf_parse_u64.c buf_parse_u8.c buf_parse_uw.c buf_save.c c3.c call.c ceiling.c cfn.c character.c compare.c env.c error.c error_handler.c eval.c f32.c f64.c fact.c facts.c facts_cursor.c facts_spec.c facts_spec_cursor.c facts_with.c facts_with_cursor.c file.c fn.c fn_clause.c frame.c hash.c ident.c integer.c io.c list.c log.c module.c operator.c ptag.c quote.c s16.c s32.c s64.c s8.c set__fact.c set__tag.c set_cursor__fact.c set_cursor__tag.c set_item__fact.c set_item__tag.c sign.c skiplist__fact.c skiplist_node__fact.c str.c sw.c sym.c tag.c timespec.c tuple.c type.c u16.c u32.c u64.c u8.c ucd.c uw.c var.c '
+LO_SOURCES='abs.c arg.c array.c binding.c bool.c buf.c buf_file.c buf_inspect.c buf_inspect_s16.c buf_inspect_s16_binary.c buf_inspect_s16_decimal.c buf_inspect_s16_hexadecimal.c buf_inspect_s16_octal.c buf_inspect_s32.c buf_inspect_s32_binary.c buf_inspect_s32_decimal.c buf_inspect_s32_hexadecimal.c buf_inspect_s32_octal.c buf_inspect_s64.c buf_inspect_s64_binary.c buf_inspect_s64_decimal.c buf_inspect_s64_hexadecimal.c buf_inspect_s64_octal.c buf_inspect_s8.c buf_inspect_s8_binary.c buf_inspect_s8_decimal.c buf_inspect_s8_hexadecimal.c buf_inspect_s8_octal.c buf_inspect_sw.c buf_inspect_sw_binary.c buf_inspect_sw_decimal.c buf_inspect_sw_hexadecimal.c buf_inspect_sw_octal.c buf_inspect_u16.c buf_inspect_u16_binary.c buf_inspect_u16_decimal.c buf_inspect_u16_hexadecimal.c buf_inspect_u16_octal.c buf_inspect_u32.c buf_inspect_u32_binary.c buf_inspect_u32_decimal.c buf_inspect_u32_hexadecimal.c buf_inspect_u32_octal.c buf_inspect_u64.c buf_inspect_u64_binary.c buf_inspect_u64_decimal.c buf_inspect_u64_hexadecimal.c buf_inspect_u64_octal.c buf_inspect_u8.c buf_inspect_u8_binary.c buf_inspect_u8_decimal.c buf_inspect_u8_hexadecimal.c buf_inspect_u8_octal.c buf_inspect_uw.c buf_inspect_uw_binary.c buf_inspect_uw_decimal.c buf_inspect_uw_hexadecimal.c buf_inspect_uw_octal.c buf_parse.c buf_parse_c.c buf_parse_s16.c buf_parse_s32.c buf_parse_s64.c buf_parse_s8.c buf_parse_sw.c buf_parse_u16.c buf_parse_u32.c buf_parse_u64.c buf_parse_u8.c buf_parse_uw.c buf_save.c c3.c call.c ceiling.c cfn.c character.c compare.c env.c error.c error_handler.c eval.c f32.c f64.c fact.c facts.c facts_cursor.c facts_spec.c facts_spec_cursor.c facts_with.c facts_with_cursor.c file.c fn.c fn_clause.c frame.c hash.c ident.c integer.c io.c list.c log.c module.c operator.c ptag.c quote.c s16.c s32.c s64.c s8.c set__fact.c set__tag.c set_cursor__fact.c set_cursor__tag.c set_item__fact.c set_item__tag.c sign.c skiplist__fact.c skiplist_node__fact.c str.c sw.c sym.c tag.c timespec.c tuple.c type.c u16.c u32.c u64.c u8.c ucd.c uw.c var.c ../libtommath/bn_cutoffs.c ../libtommath/bn_mp_2expt.c ../libtommath/bn_mp_abs.c ../libtommath/bn_mp_add.c ../libtommath/bn_mp_add_d.c ../libtommath/bn_mp_and.c ../libtommath/bn_mp_clamp.c ../libtommath/bn_mp_clear.c ../libtommath/bn_mp_clear_multi.c ../libtommath/bn_mp_cmp.c ../libtommath/bn_mp_cmp_d.c ../libtommath/bn_mp_cmp_mag.c ../libtommath/bn_mp_cnt_lsb.c ../libtommath/bn_mp_complement.c ../libtommath/bn_mp_copy.c ../libtommath/bn_mp_count_bits.c ../libtommath/bn_mp_div.c ../libtommath/bn_mp_div_2.c ../libtommath/bn_mp_div_2d.c ../libtommath/bn_mp_div_3.c ../libtommath/bn_mp_div_d.c ../libtommath/bn_mp_dr_is_modulus.c ../libtommath/bn_mp_dr_reduce.c ../libtommath/bn_mp_dr_setup.c ../libtommath/bn_mp_error_to_string.c ../libtommath/bn_mp_exch.c ../libtommath/bn_mp_exptmod.c ../libtommath/bn_mp_gcd.c ../libtommath/bn_mp_get_double.c ../libtommath/bn_mp_get_i32.c ../libtommath/bn_mp_get_i64.c ../libtommath/bn_mp_get_mag_u32.c ../libtommath/bn_mp_get_mag_u64.c ../libtommath/bn_mp_grow.c ../libtommath/bn_mp_init.c ../libtommath/bn_mp_init_copy.c ../libtommath/bn_mp_init_multi.c ../libtommath/bn_mp_init_size.c ../libtommath/bn_mp_invmod.c ../libtommath/bn_mp_lcm.c ../libtommath/bn_mp_lshd.c ../libtommath/bn_mp_mod.c ../libtommath/bn_mp_mod_2d.c ../libtommath/bn_mp_montgomery_calc_normalization.c ../libtommath/bn_mp_montgomery_reduce.c ../libtommath/bn_mp_montgomery_setup.c ../libtommath/bn_mp_mul.c ../libtommath/bn_mp_mul_2.c ../libtommath/bn_mp_mul_2d.c ../libtommath/bn_mp_mul_d.c ../libtommath/bn_mp_mulmod.c ../libtommath/bn_mp_neg.c ../libtommath/bn_mp_or.c ../libtommath/bn_mp_radix_size.c ../libtommath/bn_mp_reduce.c ../libtommath/bn_mp_reduce_2k.c ../libtommath/bn_mp_reduce_2k_l.c ../libtommath/bn_mp_reduce_2k_setup.c ../libtommath/bn_mp_reduce_2k_setup_l.c ../libtommath/bn_mp_reduce_is_2k.c ../libtommath/bn_mp_reduce_is_2k_l.c ../libtommath/bn_mp_reduce_setup.c ../libtommath/bn_mp_rshd.c ../libtommath/bn_mp_set.c ../libtommath/bn_mp_set_double.c ../libtommath/bn_mp_set_i32.c ../libtommath/bn_mp_set_i64.c ../libtommath/bn_mp_set_l.c ../libtommath/bn_mp_set_u32.c ../libtommath/bn_mp_set_u64.c ../libtommath/bn_mp_set_ul.c ../libtommath/bn_mp_sqr.c ../libtommath/bn_mp_sqrt.c ../libtommath/bn_mp_sub.c ../libtommath/bn_mp_sub_d.c ../libtommath/bn_mp_xor.c ../libtommath/bn_mp_zero.c ../libtommath/bn_s_mp_add.c ../libtommath/bn_s_mp_balance_mul.c ../libtommath/bn_s_mp_exptmod.c ../libtommath/bn_s_mp_exptmod_fast.c ../libtommath/bn_s_mp_invmod_fast.c ../libtommath/bn_s_mp_invmod_slow.c ../libtommath/bn_s_mp_karatsuba_mul.c ../libtommath/bn_s_mp_karatsuba_sqr.c ../libtommath/bn_s_mp_montgomery_reduce_fast.c ../libtommath/bn_s_mp_mul_digs.c ../libtommath/bn_s_mp_mul_digs_fast.c ../libtommath/bn_s_mp_mul_high_digs.c ../libtommath/bn_s_mp_mul_high_digs_fast.c ../libtommath/bn_s_mp_rand_platform.c ../libtommath/bn_s_mp_sqr.c ../libtommath/bn_s_mp_sqr_fast.c ../libtommath/bn_s_mp_sub.c ../libtommath/bn_s_mp_toom_mul.c ../libtommath/bn_s_mp_toom_sqr.c  '
diff --git a/libc3/sw.c b/libc3/sw.c
index 396ec19..99132fa 100644
--- a/libc3/sw.c
+++ b/libc3/sw.c
@@ -79,3 +79,11 @@ sw sw_cast (s_tag *tag)
         tag_type_to_sym(tag->type)->str.ptr.ps8);
   return 0;
 }
+
+sw * sw_copy (const sw *src, sw *dest)
+{
+  assert(src);
+  assert(dest);
+  *dest = *src;
+  return dest;
+}
diff --git a/libc3/sw.h b/libc3/sw.h
index 4481b26..9c869bf 100644
--- a/libc3/sw.h
+++ b/libc3/sw.h
@@ -16,6 +16,7 @@
 
 #include "types.h"
 
-sw sw_cast (s_tag *tag);
+sw   sw_cast (s_tag *tag);
+sw * sw_copy (const sw *src, sw *dest);
 
 #endif /* S8_H */
diff --git a/libc3/sym.c b/libc3/sym.c
index c6192ed..0c8018f 100644
--- a/libc3/sym.c
+++ b/libc3/sym.c
@@ -50,6 +50,14 @@ bool sym_character_is_reserved (character c)
           c == '}');
 }
 
+const s_sym ** sym_copy (const s_sym **src, const s_sym **dest)
+{
+  assert(src);
+  assert(dest);
+  *dest = *src;
+  return dest;
+}
+
 void sym_delete (s_sym *sym)
 {
   str_clean(&sym->str);
diff --git a/libc3/sym.h b/libc3/sym.h
index 7b849ca..2303446 100644
--- a/libc3/sym.h
+++ b/libc3/sym.h
@@ -33,6 +33,8 @@ const s_sym * sym_1 (const s8 *p);
 
 bool sym_character_is_reserved (character c);
 
+const s_sym ** sym_copy (const s_sym **src, const s_sym **dest);
+
 /** @brief Call when exiting program. */
 void sym_delete_all ();
 
diff --git a/libc3/types.h b/libc3/types.h
index fd51755..297f936 100644
--- a/libc3/types.h
+++ b/libc3/types.h
@@ -151,7 +151,10 @@ typedef const s_tag *p_tag;
 typedef u64          t_skiplist_height;
 
 /* function typedefs */
+typedef sw (* f_buf_inspect) (s_buf *buf, const void *x);
+typedef sw (* f_buf_inspect_size) (const void *x);
 typedef sw (* f_buf_parse) (s_buf *buf, void *dest);
+typedef void * (* f_copy) (const void *a, void *b);
 
 #define CHARACTER_MAX S32_MAX
 #define SKIPLIST_HEIGHT_MAX U64_MAX
@@ -510,8 +513,4 @@ struct facts_with_cursor {
   pthread_mutex_t mutex;
 };
 
-/* Functions */
-typedef sw (* f_buf_inspect) (s_buf *buf, const void *x);
-typedef sw (* f_buf_inspect_size) (const void *x);
-
 #endif /* TYPES_H */
diff --git a/libc3/u.c.in b/libc3/u.c.in
index df6d89b..2e8c9d8 100644
--- a/libc3/u.c.in
+++ b/libc3/u.c.in
@@ -79,3 +79,11 @@ u_bits$ u_bits$_cast (s_tag *tag)
         tag_type_to_sym(tag->type)->str.ptr.ps8);
   return 0;
 }
+
+u_bits$ * u_bits$_copy (const u_bits$ *src, u_bits$ *dest)
+{
+  assert(src);
+  assert(dest);
+  *dest = *src;
+  return dest;
+}
diff --git a/libc3/u.h.in b/libc3/u.h.in
index a178ffb..76861d2 100644
--- a/libc3/u.h.in
+++ b/libc3/u.h.in
@@ -16,6 +16,7 @@
 
 #include "types.h"
 
-u_bits$ u_bits$_cast (s_tag *tag);
+u_bits$   u_bits$_cast (s_tag *tag);
+u_bits$ * u_bits$_copy (const u_bits$ *src, u_bits$ *dest);
 
 #endif /* U8_H */
diff --git a/libc3/u16.c b/libc3/u16.c
index ef90723..8772877 100644
--- a/libc3/u16.c
+++ b/libc3/u16.c
@@ -79,3 +79,11 @@ u16 u16_cast (s_tag *tag)
         tag_type_to_sym(tag->type)->str.ptr.ps8);
   return 0;
 }
+
+u16 * u16_copy (const u16 *src, u16 *dest)
+{
+  assert(src);
+  assert(dest);
+  *dest = *src;
+  return dest;
+}
diff --git a/libc3/u16.h b/libc3/u16.h
index 33cc86b..05b5ab4 100644
--- a/libc3/u16.h
+++ b/libc3/u16.h
@@ -16,6 +16,7 @@
 
 #include "types.h"
 
-u16 u16_cast (s_tag *tag);
+u16   u16_cast (s_tag *tag);
+u16 * u16_copy (const u16 *src, u16 *dest);
 
 #endif /* U8_H */
diff --git a/libc3/u32.c b/libc3/u32.c
index 1f3cb10..c6fc325 100644
--- a/libc3/u32.c
+++ b/libc3/u32.c
@@ -79,3 +79,11 @@ u32 u32_cast (s_tag *tag)
         tag_type_to_sym(tag->type)->str.ptr.ps8);
   return 0;
 }
+
+u32 * u32_copy (const u32 *src, u32 *dest)
+{
+  assert(src);
+  assert(dest);
+  *dest = *src;
+  return dest;
+}
diff --git a/libc3/u32.h b/libc3/u32.h
index c4d204d..c54a3a6 100644
--- a/libc3/u32.h
+++ b/libc3/u32.h
@@ -16,6 +16,7 @@
 
 #include "types.h"
 
-u32 u32_cast (s_tag *tag);
+u32   u32_cast (s_tag *tag);
+u32 * u32_copy (const u32 *src, u32 *dest);
 
 #endif /* U8_H */
diff --git a/libc3/u64.c b/libc3/u64.c
index ef22e46..0c65ba8 100644
--- a/libc3/u64.c
+++ b/libc3/u64.c
@@ -79,3 +79,11 @@ u64 u64_cast (s_tag *tag)
         tag_type_to_sym(tag->type)->str.ptr.ps8);
   return 0;
 }
+
+u64 * u64_copy (const u64 *src, u64 *dest)
+{
+  assert(src);
+  assert(dest);
+  *dest = *src;
+  return dest;
+}
diff --git a/libc3/u64.h b/libc3/u64.h
index 0999141..e4f188d 100644
--- a/libc3/u64.h
+++ b/libc3/u64.h
@@ -16,6 +16,7 @@
 
 #include "types.h"
 
-u64 u64_cast (s_tag *tag);
+u64   u64_cast (s_tag *tag);
+u64 * u64_copy (const u64 *src, u64 *dest);
 
 #endif /* U8_H */
diff --git a/libc3/u8.c b/libc3/u8.c
index 29fba4a..6f00b8d 100644
--- a/libc3/u8.c
+++ b/libc3/u8.c
@@ -79,3 +79,11 @@ u8 u8_cast (s_tag *tag)
         tag_type_to_sym(tag->type)->str.ptr.ps8);
   return 0;
 }
+
+u8 * u8_copy (const u8 *src, u8 *dest)
+{
+  assert(src);
+  assert(dest);
+  *dest = *src;
+  return dest;
+}
diff --git a/libc3/u8.h b/libc3/u8.h
index 4a7654d..2767023 100644
--- a/libc3/u8.h
+++ b/libc3/u8.h
@@ -16,6 +16,7 @@
 
 #include "types.h"
 
-u8 u8_cast (s_tag *tag);
+u8   u8_cast (s_tag *tag);
+u8 * u8_copy (const u8 *src, u8 *dest);
 
 #endif /* U8_H */
diff --git a/libc3/uw.c b/libc3/uw.c
index 94145b3..a43e148 100644
--- a/libc3/uw.c
+++ b/libc3/uw.c
@@ -79,3 +79,11 @@ uw uw_cast (s_tag *tag)
         tag_type_to_sym(tag->type)->str.ptr.ps8);
   return 0;
 }
+
+uw * uw_copy (const uw *src, uw *dest)
+{
+  assert(src);
+  assert(dest);
+  *dest = *src;
+  return dest;
+}
diff --git a/libc3/uw.h b/libc3/uw.h
index 823bad0..d8f656c 100644
--- a/libc3/uw.h
+++ b/libc3/uw.h
@@ -16,6 +16,7 @@
 
 #include "types.h"
 
-uw uw_cast (s_tag *tag);
+uw   uw_cast (s_tag *tag);
+uw * uw_copy (const uw *src, uw *dest);
 
 #endif /* U8_H */
diff --git a/libc3/var.c b/libc3/var.c
new file mode 100644
index 0000000..e1834e4
--- /dev/null
+++ b/libc3/var.c
@@ -0,0 +1,25 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+#include <assert.h>
+#include <err.h>
+#include "tag.h"
+#include "var.h"
+
+s_tag * var_copy (const s_tag *src, s_tag *dest)
+{
+  assert(src);
+  assert(dest);
+  (void) src;
+  tag_init_void(dest);
+  return dest;
+}
diff --git a/libc3/var.h b/libc3/var.h
new file mode 100644
index 0000000..1797bf7
--- /dev/null
+++ b/libc3/var.h
@@ -0,0 +1,20 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+#ifndef VAR_H
+#define VAR_H
+
+#include "types.h"
+
+s_tag * var_copy (const s_tag *src, s_tag *dest);
+
+#endif /* VAR_H */
diff --git a/sources.mk b/sources.mk
index 9e67933..f5fe05f 100644
--- a/sources.mk
+++ b/sources.mk
@@ -229,6 +229,9 @@ C3_C_SOURCES = \
 	libc3/skiplist_node__fact.c \
 	libc3/skiplist_node__fact.h \
 	libc3/types.h \
+	libc3/f64.h \
+	libc3/f32.c \
+	libc3/f64.c \
 	libc3/hash.h \
 	libc3/ident.h \
 	libc3/integer.c \
@@ -260,6 +263,7 @@ C3_C_SOURCES = \
 	libc3/buf_inspect.h \
 	libc3/set_item.c.in \
 	libc3/set_item.h.in \
+	libc3/tag.c \
 	libc3/s.h.in \
 	libc3/sign.c \
 	libc3/sign.h \
@@ -306,9 +310,14 @@ C3_C_SOURCES = \
 	libc3/u32.c \
 	libc3/u64.c \
 	libc3/uw.c \
+	libc3/ptag.h \
+	libc3/f32.h \
 	libc3/fn_clause.h \
 	libc3/s.c.in \
 	libc3/fn_clause.c \
+	libc3/ptag.c \
+	libc3/var.h \
+	libc3/var.c \
 	libc3/facts.c \
 	libc3/u8.c \
 	libc3/facts.h \
@@ -316,7 +325,6 @@ C3_C_SOURCES = \
 	libc3/c3_main.h \
 	libc3/file.h \
 	libc3/hash.c \
-	libc3/tag.c \
 	test/buf_inspect_test.c \
 	test/bool_test.c \
 	test/buf_parse_test.c \
diff --git a/sources.sh b/sources.sh
index f624beb..2286a5c 100644
--- a/sources.sh
+++ b/sources.sh
@@ -1,4 +1,4 @@
 # sources.sh generated by update_sources
 C3_CONFIGURES='c3c/configure c3s/configure c3s/update_sources ic3/configure ic3/update_sources libc3/configure libc3/update_sources libtommath/configure libtommath/update_sources test/configure test/update_sources ucd2c/configure '
 C3_MAKEFILES='c3c/Makefile c3s/Makefile ic3/Makefile libc3/Makefile libc3/gen.mk libtommath/Makefile test/Makefile ucd2c/Makefile '
-C3_C_SOURCES='c3c/c3c.c c3s/buf_readline.c c3s/c3s.c c3s/buf_readline.h ic3/ic3.c ic3/buf_linenoise.c ic3/buf_linenoise.h ic3/linenoise.c libc3/abs.c libc3/abs.h libc3/buf.c libc3/buf.h libc3/buf_inspect_s8.c libc3/buf_inspect_s8.h libc3/buf_inspect_s8_binary.c libc3/buf_inspect_s8_binary.h libc3/buf_inspect_s8_octal.c libc3/buf_inspect_s8_octal.h libc3/buf_inspect_s8_decimal.c libc3/buf_inspect_s8_decimal.h libc3/call.c libc3/arg.c libc3/arg.h libc3/array.c libc3/array.h libc3/binding.c libc3/c3.c libc3/buf_inspect_s8_hexadecimal.c libc3/buf_inspect_s8_hexadecimal.h libc3/buf_inspect_s16.c libc3/binding.h libc3/buf_inspect_s16.h libc3/buf_inspect_s16_binary.c libc3/buf_inspect_s16_binary.h libc3/buf_inspect_s16_octal.c libc3/buf_inspect_s16_octal.h libc3/buf_inspect_s16_decimal.c libc3/buf_inspect_s16_decimal.h libc3/buf_inspect_s16_hexadecimal.c libc3/bool.c libc3/bool.h libc3/buf_file.c libc3/buf_file.h libc3/buf_inspect_s16_hexadecimal.h libc3/buf_inspect_s32.c libc3/buf_inspect_s32.h libc3/buf_inspect_s32_binary.c libc3/buf_inspect_s32_binary.h libc3/buf_inspect_s32_octal.c libc3/buf_inspect_s32_octal.h libc3/buf_inspect_s32_decimal.c libc3/buf_inspect_s32_decimal.h libc3/buf_inspect_s32_hexadecimal.c libc3/buf_inspect_s32_hexadecimal.h libc3/buf_inspect_s64.c libc3/buf_parse.h libc3/buf_parse_c.c libc3/buf_save.c libc3/buf_inspect_s64.h libc3/facts_spec_cursor.c libc3/buf_inspect_s64_binary.c libc3/buf_inspect_s64_binary.h libc3/buf_inspect_s64_octal.c libc3/buf_inspect_s64_octal.h libc3/buf_inspect_s64_decimal.c libc3/buf_inspect_s64_decimal.h libc3/buf_inspect_s64_hexadecimal.c libc3/buf_inspect_s64_hexadecimal.h libc3/buf_inspect_sw.c libc3/buf_inspect_sw.h libc3/buf_inspect_sw_binary.c libc3/buf_parse_c.h libc3/buf_save.h libc3/c3.h libc3/c_types.h libc3/call.h libc3/buf_inspect_sw_binary.h libc3/buf_inspect_sw_octal.c libc3/buf_inspect_sw_octal.h libc3/buf_inspect_sw_decimal.c libc3/buf_inspect_sw_decimal.h libc3/buf_inspect_sw_hexadecimal.c libc3/buf_inspect_sw_hexadecimal.h libc3/buf_inspect_u8.c libc3/buf_inspect_u8.h libc3/buf_inspect_u8_binary.c libc3/buf_inspect_u8_binary.h libc3/buf_inspect_u8_octal.c libc3/ceiling.c libc3/ceiling.h libc3/cfn.c libc3/cfn.h libc3/character.c libc3/character.h libc3/buf_inspect_u8_octal.h libc3/buf_inspect_u8_decimal.c libc3/buf_inspect_u8_decimal.h libc3/buf_inspect_u8_hexadecimal.c libc3/buf_inspect_u8_hexadecimal.h libc3/buf_inspect_u16.c libc3/buf_inspect_u16.h libc3/buf_inspect_u16_binary.c libc3/buf_inspect_u16_binary.h libc3/buf_inspect_u16_octal.c libc3/buf_inspect_u16_octal.h libc3/buf_parse_s8.c libc3/compare.c libc3/buf_inspect.c libc3/compare.h libc3/buf_parse.c libc3/timespec.h libc3/operator.c libc3/operator.h libc3/sym.c libc3/buf_inspect_u16_decimal.c libc3/buf_inspect_u16_decimal.h libc3/buf_inspect_u16_hexadecimal.c libc3/buf_inspect_u16_hexadecimal.h libc3/buf_inspect_u32.c libc3/u8.h libc3/buf_inspect_u32.h libc3/buf_inspect_u32_binary.c libc3/buf_inspect_u32_binary.h libc3/error.c libc3/error.h libc3/error_handler.c libc3/error_handler.h libc3/eval.c libc3/eval.h libc3/buf_inspect_u32_octal.c libc3/buf_inspect_u32_octal.h libc3/buf_inspect_u32_decimal.c libc3/buf_inspect_u32_decimal.h libc3/buf_inspect_u32_hexadecimal.c libc3/buf_inspect_u32_hexadecimal.h libc3/buf_inspect_u64.c libc3/buf_inspect_u64.h libc3/buf_inspect_u64_binary.c libc3/buf_inspect_u64_binary.h libc3/buf_inspect_u64_octal.c libc3/buf_parse_s8.h libc3/fact.c libc3/fact.h libc3/facts_cursor.c libc3/buf_inspect_u64_octal.h libc3/buf_inspect_u64_decimal.c libc3/buf_inspect_u64_decimal.h libc3/buf_inspect_u64_hexadecimal.c libc3/buf_inspect_u64_hexadecimal.h libc3/buf_inspect_uw.c libc3/buf_inspect_uw.h libc3/buf_inspect_uw_binary.c libc3/buf_inspect_uw_binary.h libc3/buf_inspect_uw_octal.c libc3/buf_inspect_uw_octal.h libc3/buf_inspect_uw_decimal.c libc3/buf_inspect_uw_decimal.h libc3/facts_cursor.h libc3/facts_spec.c libc3/facts_spec.h libc3/facts_spec_cursor.h libc3/buf_inspect_uw_hexadecimal.c libc3/buf_inspect_uw_hexadecimal.h libc3/buf_parse_s16.c libc3/buf_parse_s16.h libc3/buf_parse_s32.c libc3/buf_parse_s32.h libc3/buf_parse_s64.c libc3/buf_parse_s64.h libc3/buf_parse_sw.c libc3/buf_parse_sw.h libc3/buf_parse_u8.c libc3/buf_parse_u8.h libc3/buf_parse_u16.c libc3/buf_parse_u16.h libc3/buf_parse_u32.c libc3/set__fact.c libc3/facts_with.c libc3/facts_with.h libc3/facts_with_cursor.c libc3/buf_parse_u32.h libc3/buf_parse_u64.c libc3/buf_parse_u64.h libc3/buf_parse_uw.c libc3/buf_parse_uw.h libc3/set__fact.h libc3/set__tag.c libc3/set__tag.h libc3/set_cursor__fact.c libc3/set_cursor__fact.h libc3/set_cursor__tag.c libc3/set_cursor__tag.h libc3/set_item__fact.c libc3/set_item__fact.h libc3/set_item__tag.c libc3/set_item__tag.h libc3/skiplist__fact.c libc3/facts_with_cursor.h libc3/float.h libc3/frame.c libc3/frame.h libc3/skiplist__fact.h libc3/skiplist_node__fact.c libc3/skiplist_node__fact.h libc3/types.h libc3/hash.h libc3/ident.h libc3/integer.c libc3/integer.h libc3/io.c libc3/io.h libc3/list.c libc3/list.h libc3/log.c libc3/log.h libc3/buf_inspect_s.h.in libc3/module.c libc3/str.c libc3/module.h libc3/buf_parse_u.c.in libc3/quote.c libc3/quote.h libc3/s32.h libc3/s64.c libc3/s64.h libc3/sw.c libc3/sw.h libc3/set.c.in libc3/set.h.in libc3/buf_inspect_s_base.h.in libc3/sha1.h libc3/set_cursor.c.in libc3/set_cursor.h.in libc3/buf_inspect.h libc3/set_item.c.in libc3/set_item.h.in libc3/s.h.in libc3/sign.c libc3/sign.h libc3/skiplist.c.in libc3/skiplist.h.in libc3/type.h libc3/skiplist_node.c.in libc3/skiplist_node.h.in libc3/str.h libc3/s8.c libc3/ucd.c libc3/sym.h libc3/tuple.c libc3/tuple.h libc3/type.c libc3/ucd.h libc3/buf_parse_s.c.in libc3/buf_parse_s.h.in libc3/buf_inspect_s.c.in libc3/buf_parse_u.h.in libc3/env.c libc3/ident.c libc3/buf_inspect_s_base.c.in libc3/buf_inspect_u.c.in libc3/buf_inspect_u.h.in libc3/env.h libc3/s8.h libc3/s16.c libc3/buf_inspect_u_base.c.in libc3/buf_inspect_u_base.h.in libc3/timespec.c libc3/s16.h libc3/s32.c libc3/u16.h libc3/u.c.in libc3/fn.c libc3/u.h.in libc3/fn.h libc3/tag.h libc3/u32.h libc3/u64.h libc3/uw.h libc3/u16.c libc3/u32.c libc3/u64.c libc3/uw.c libc3/fn_clause.h libc3/s.c.in libc3/fn_clause.c libc3/facts.c libc3/u8.c libc3/facts.h libc3/file.c libc3/c3_main.h libc3/file.h libc3/hash.c libc3/tag.c test/buf_inspect_test.c test/bool_test.c test/buf_parse_test.c test/facts_test.c test/buf_file_test.c test/list_test.c test/test.c test/test.h test/buf_parse_test_u8.c test/buf_parse_test.h test/buf_parse_test_s16.c test/buf_parse_test_s32.c test/buf_parse_test_s64.c test/buf_parse_test_s8.c test/buf_parse_test_su.h test/buf_parse_test_u16.c test/buf_parse_test_u32.c test/buf_test.c test/buf_parse_test_u64.c test/call_test.c test/facts_cursor_test.c test/cfn_test.c test/character_test.c test/compare_test.c test/compare_test.h test/env_test.c test/fact_test.c test/fact_test.h test/facts_with_test.c test/hash_test.c test/ident_test.c test/set__fact_test.c test/set__tag_test.c test/skiplist__fact_test.c test/str_test.c test/sym_test.c test/tag_test.c test/tag_test.h test/array_test.c test/fn_test.c test/tuple_test.c test/types_test.c test/libc3_test.c ucd2c/ucd.h ucd2c/ucd2c.c '
+C3_C_SOURCES='c3c/c3c.c c3s/buf_readline.c c3s/c3s.c c3s/buf_readline.h ic3/ic3.c ic3/buf_linenoise.c ic3/buf_linenoise.h ic3/linenoise.c libc3/abs.c libc3/abs.h libc3/buf.c libc3/buf.h libc3/buf_inspect_s8.c libc3/buf_inspect_s8.h libc3/buf_inspect_s8_binary.c libc3/buf_inspect_s8_binary.h libc3/buf_inspect_s8_octal.c libc3/buf_inspect_s8_octal.h libc3/buf_inspect_s8_decimal.c libc3/buf_inspect_s8_decimal.h libc3/call.c libc3/arg.c libc3/arg.h libc3/array.c libc3/array.h libc3/binding.c libc3/c3.c libc3/buf_inspect_s8_hexadecimal.c libc3/buf_inspect_s8_hexadecimal.h libc3/buf_inspect_s16.c libc3/binding.h libc3/buf_inspect_s16.h libc3/buf_inspect_s16_binary.c libc3/buf_inspect_s16_binary.h libc3/buf_inspect_s16_octal.c libc3/buf_inspect_s16_octal.h libc3/buf_inspect_s16_decimal.c libc3/buf_inspect_s16_decimal.h libc3/buf_inspect_s16_hexadecimal.c libc3/bool.c libc3/bool.h libc3/buf_file.c libc3/buf_file.h libc3/buf_inspect_s16_hexadecimal.h libc3/buf_inspect_s32.c libc3/buf_inspect_s32.h libc3/buf_inspect_s32_binary.c libc3/buf_inspect_s32_binary.h libc3/buf_inspect_s32_octal.c libc3/buf_inspect_s32_octal.h libc3/buf_inspect_s32_decimal.c libc3/buf_inspect_s32_decimal.h libc3/buf_inspect_s32_hexadecimal.c libc3/buf_inspect_s32_hexadecimal.h libc3/buf_inspect_s64.c libc3/buf_parse.h libc3/buf_parse_c.c libc3/buf_save.c libc3/buf_inspect_s64.h libc3/facts_spec_cursor.c libc3/buf_inspect_s64_binary.c libc3/buf_inspect_s64_binary.h libc3/buf_inspect_s64_octal.c libc3/buf_inspect_s64_octal.h libc3/buf_inspect_s64_decimal.c libc3/buf_inspect_s64_decimal.h libc3/buf_inspect_s64_hexadecimal.c libc3/buf_inspect_s64_hexadecimal.h libc3/buf_inspect_sw.c libc3/buf_inspect_sw.h libc3/buf_inspect_sw_binary.c libc3/buf_parse_c.h libc3/buf_save.h libc3/c3.h libc3/c_types.h libc3/call.h libc3/buf_inspect_sw_binary.h libc3/buf_inspect_sw_octal.c libc3/buf_inspect_sw_octal.h libc3/buf_inspect_sw_decimal.c libc3/buf_inspect_sw_decimal.h libc3/buf_inspect_sw_hexadecimal.c libc3/buf_inspect_sw_hexadecimal.h libc3/buf_inspect_u8.c libc3/buf_inspect_u8.h libc3/buf_inspect_u8_binary.c libc3/buf_inspect_u8_binary.h libc3/buf_inspect_u8_octal.c libc3/ceiling.c libc3/ceiling.h libc3/cfn.c libc3/cfn.h libc3/character.c libc3/character.h libc3/buf_inspect_u8_octal.h libc3/buf_inspect_u8_decimal.c libc3/buf_inspect_u8_decimal.h libc3/buf_inspect_u8_hexadecimal.c libc3/buf_inspect_u8_hexadecimal.h libc3/buf_inspect_u16.c libc3/buf_inspect_u16.h libc3/buf_inspect_u16_binary.c libc3/buf_inspect_u16_binary.h libc3/buf_inspect_u16_octal.c libc3/buf_inspect_u16_octal.h libc3/buf_parse_s8.c libc3/compare.c libc3/buf_inspect.c libc3/compare.h libc3/buf_parse.c libc3/timespec.h libc3/operator.c libc3/operator.h libc3/sym.c libc3/buf_inspect_u16_decimal.c libc3/buf_inspect_u16_decimal.h libc3/buf_inspect_u16_hexadecimal.c libc3/buf_inspect_u16_hexadecimal.h libc3/buf_inspect_u32.c libc3/u8.h libc3/buf_inspect_u32.h libc3/buf_inspect_u32_binary.c libc3/buf_inspect_u32_binary.h libc3/error.c libc3/error.h libc3/error_handler.c libc3/error_handler.h libc3/eval.c libc3/eval.h libc3/buf_inspect_u32_octal.c libc3/buf_inspect_u32_octal.h libc3/buf_inspect_u32_decimal.c libc3/buf_inspect_u32_decimal.h libc3/buf_inspect_u32_hexadecimal.c libc3/buf_inspect_u32_hexadecimal.h libc3/buf_inspect_u64.c libc3/buf_inspect_u64.h libc3/buf_inspect_u64_binary.c libc3/buf_inspect_u64_binary.h libc3/buf_inspect_u64_octal.c libc3/buf_parse_s8.h libc3/fact.c libc3/fact.h libc3/facts_cursor.c libc3/buf_inspect_u64_octal.h libc3/buf_inspect_u64_decimal.c libc3/buf_inspect_u64_decimal.h libc3/buf_inspect_u64_hexadecimal.c libc3/buf_inspect_u64_hexadecimal.h libc3/buf_inspect_uw.c libc3/buf_inspect_uw.h libc3/buf_inspect_uw_binary.c libc3/buf_inspect_uw_binary.h libc3/buf_inspect_uw_octal.c libc3/buf_inspect_uw_octal.h libc3/buf_inspect_uw_decimal.c libc3/buf_inspect_uw_decimal.h libc3/facts_cursor.h libc3/facts_spec.c libc3/facts_spec.h libc3/facts_spec_cursor.h libc3/buf_inspect_uw_hexadecimal.c libc3/buf_inspect_uw_hexadecimal.h libc3/buf_parse_s16.c libc3/buf_parse_s16.h libc3/buf_parse_s32.c libc3/buf_parse_s32.h libc3/buf_parse_s64.c libc3/buf_parse_s64.h libc3/buf_parse_sw.c libc3/buf_parse_sw.h libc3/buf_parse_u8.c libc3/buf_parse_u8.h libc3/buf_parse_u16.c libc3/buf_parse_u16.h libc3/buf_parse_u32.c libc3/set__fact.c libc3/facts_with.c libc3/facts_with.h libc3/facts_with_cursor.c libc3/buf_parse_u32.h libc3/buf_parse_u64.c libc3/buf_parse_u64.h libc3/buf_parse_uw.c libc3/buf_parse_uw.h libc3/set__fact.h libc3/set__tag.c libc3/set__tag.h libc3/set_cursor__fact.c libc3/set_cursor__fact.h libc3/set_cursor__tag.c libc3/set_cursor__tag.h libc3/set_item__fact.c libc3/set_item__fact.h libc3/set_item__tag.c libc3/set_item__tag.h libc3/skiplist__fact.c libc3/facts_with_cursor.h libc3/float.h libc3/frame.c libc3/frame.h libc3/skiplist__fact.h libc3/skiplist_node__fact.c libc3/skiplist_node__fact.h libc3/types.h libc3/f64.h libc3/f32.c libc3/f64.c libc3/hash.h libc3/ident.h libc3/integer.c libc3/integer.h libc3/io.c libc3/io.h libc3/list.c libc3/list.h libc3/log.c libc3/log.h libc3/buf_inspect_s.h.in libc3/module.c libc3/str.c libc3/module.h libc3/buf_parse_u.c.in libc3/quote.c libc3/quote.h libc3/s32.h libc3/s64.c libc3/s64.h libc3/sw.c libc3/sw.h libc3/set.c.in libc3/set.h.in libc3/buf_inspect_s_base.h.in libc3/sha1.h libc3/set_cursor.c.in libc3/set_cursor.h.in libc3/buf_inspect.h libc3/set_item.c.in libc3/set_item.h.in libc3/tag.c libc3/s.h.in libc3/sign.c libc3/sign.h libc3/skiplist.c.in libc3/skiplist.h.in libc3/type.h libc3/skiplist_node.c.in libc3/skiplist_node.h.in libc3/str.h libc3/s8.c libc3/ucd.c libc3/sym.h libc3/tuple.c libc3/tuple.h libc3/type.c libc3/ucd.h libc3/buf_parse_s.c.in libc3/buf_parse_s.h.in libc3/buf_inspect_s.c.in libc3/buf_parse_u.h.in libc3/env.c libc3/ident.c libc3/buf_inspect_s_base.c.in libc3/buf_inspect_u.c.in libc3/buf_inspect_u.h.in libc3/env.h libc3/s8.h libc3/s16.c libc3/buf_inspect_u_base.c.in libc3/buf_inspect_u_base.h.in libc3/timespec.c libc3/s16.h libc3/s32.c libc3/u16.h libc3/u.c.in libc3/fn.c libc3/u.h.in libc3/fn.h libc3/tag.h libc3/u32.h libc3/u64.h libc3/uw.h libc3/u16.c libc3/u32.c libc3/u64.c libc3/uw.c libc3/ptag.h libc3/f32.h libc3/fn_clause.h libc3/s.c.in libc3/fn_clause.c libc3/ptag.c libc3/var.h libc3/var.c libc3/facts.c libc3/u8.c libc3/facts.h libc3/file.c libc3/c3_main.h libc3/file.h libc3/hash.c test/buf_inspect_test.c test/bool_test.c test/buf_parse_test.c test/facts_test.c test/buf_file_test.c test/list_test.c test/test.c test/test.h test/buf_parse_test_u8.c test/buf_parse_test.h test/buf_parse_test_s16.c test/buf_parse_test_s32.c test/buf_parse_test_s64.c test/buf_parse_test_s8.c test/buf_parse_test_su.h test/buf_parse_test_u16.c test/buf_parse_test_u32.c test/buf_test.c test/buf_parse_test_u64.c test/call_test.c test/facts_cursor_test.c test/cfn_test.c test/character_test.c test/compare_test.c test/compare_test.h test/env_test.c test/fact_test.c test/fact_test.h test/facts_with_test.c test/hash_test.c test/ident_test.c test/set__fact_test.c test/set__tag_test.c test/skiplist__fact_test.c test/str_test.c test/sym_test.c test/tag_test.c test/tag_test.h test/array_test.c test/fn_test.c test/tuple_test.c test/types_test.c test/libc3_test.c ucd2c/ucd.h ucd2c/ucd2c.c '
diff --git a/test/array_test.c b/test/array_test.c
index b7c224d..f282c79 100644
--- a/test/array_test.c
+++ b/test/array_test.c
@@ -116,5 +116,13 @@ TEST_CASE(array_inspect)
                      "(U8) {{{0, 0}, {0, 0}}, {{0, 0}, {0, 0}}, {{0, 0}, {0, 0}}}");
   ARRAY_TEST_INSPECT("(U8) {1, 2, 3}", "(U8) {1, 2, 3}");
   ARRAY_TEST_INSPECT("(U8) {1 + 1, 2 + 2, 3 + 3}", "(U8) {2, 4, 6}");
+  ARRAY_TEST_INSPECT("(U8) {255 + 1, 255 + 2, 255 + 3}", "(U8) {0, 1, 2}");
+  ARRAY_TEST_INSPECT("(U16) {255 + 1, 255 + 2, 255 + 3}", "(U16) {256, 257, 258}");
+  ARRAY_TEST_INSPECT("(U16) {65535 + 1, 65535 + 2, 65535 + 3}", "(U16) {0, 1, 2}");
+  ARRAY_TEST_INSPECT("(U32) {65535 + 1, 65535 + 2, 65535 + 3}", "(U32) {65536, 65537, 65538}");
+  ARRAY_TEST_INSPECT("(U32) {4294967295 + 1, 4294967295 + 2, 4294967295 + 3}", "(U32) {0, 1, 2}");
+  ARRAY_TEST_INSPECT("(U64) {4294967295 + 1, 4294967295 + 2, 4294967295 + 3}", "(U64) {4294967296, 4294967297, 4294967298}");
+  ARRAY_TEST_INSPECT("(U64) {18446744073709551615 + 1, 18446744073709551615 + 2, 18446744073709551615 + 3}", "(U64) {0, 1, 2}");
+  ARRAY_TEST_INSPECT("(Integer) {18446744073709551615 + 1, 18446744073709551615 + 2, 18446744073709551615 + 3}", "(Integer) {18446744073709551616, 18446744073709551617, 18446744073709551618}");
 }
 TEST_CASE_END(array_inspect)
diff --git a/test/ic3/cast.in b/test/ic3/cast.in
index ad06b8e..e9b3683 100644
--- a/test/ic3/cast.in
+++ b/test/ic3/cast.in
@@ -1,2 +1,26 @@
+quote (U8) 0
+(U8) 0
+quote (U8) 1
+(U8) 1
+quote (U8) 255
+(U8) 255
 quote (U8) 256
+(U8) 256
+quote (U16) 256
+(U16) 256
+quote (U16) 65535
+(U16) 65535
 quote (U16) 65536
+(U16) 65536
+quote (U32) 65536
+(U32) 65536
+quote (U32) 4294967296
+(U32) 4294967296
+quote (U64) 4294967296
+(U64) 4294967296
+quote (U64) 18446744073709551616
+(U64) 18446744073709551616
+quote (Integer) 18446744073709551616
+(Integer) 18446744073709551616
+quote (Integer) 340282366920938463463374607431768211455
+(Integer) 340282366920938463463374607431768211455
diff --git a/test/ic3/cast.out.expected b/test/ic3/cast.out.expected
index 6944714..bcf07a7 100644
--- a/test/ic3/cast.out.expected
+++ b/test/ic3/cast.out.expected
@@ -1,2 +1,26 @@
+(U8) 0
+0
+(U8) 1
+1
+(U8) 255
+255
 (U8) 256
+0
+(U16) 256
+256
+(U16) 65535
+65535
 (U16) 65536
+0
+(U32) 65536
+65536
+(U32) 4294967296
+0
+(U64) 4294967296
+4294967296
+(U64) 18446744073709551616
+0
+(Integer) 18446744073709551616
+18446744073709551616
+(Integer) 340282366920938463463374607431768211455
+340282366920938463463374607431768211455