gc and cons pairs

This commit is contained in:
Lobo 2026-01-06 13:03:59 -03:00
parent d64b0f0a6f
commit fe9a8a7039
8 changed files with 217 additions and 10 deletions

11
main.c
View file

@ -1,12 +1,15 @@
#include <stdio.h>
#include "wscm.h"
int main(void) {
gcinit();
const S *hello = intern("hello", -1);
printf("hello = %p\n", (void *)hello);
const S *goodbye = intern("goodbye", -1);
O p = cons(BOX(hello), BOX(goodbye));
addroot(&p);
const S *hello2 = intern("hello", -1);
printf("hello2 = %p (should be equal to hello)\n", (void *)hello2);
collect();
gcfinalize();
return 0;
}