--- /dev/null
+#ifndef LIST_H
+#define LIST_H
+
+#include <stdbool.h>
+
+#define FOREACH(x, l) for(struct list *x = l; x != NULL; x = x->tail)
+
+struct list {
+ void *el;
+ struct list *tail;
+};
+
+struct list *list_append(void *el, struct list *head);
+struct list *list_cons(void *el, struct list *tail);
+void list_free(struct list *head, void (*freefun)(void *));
+void **list_to_array(struct list *list, int *num, bool reverse);
+int list_length(struct list *head);
+
+#endif