list.h

Go to the documentation of this file.
00001 #include <stdbool.h>
00002 
00004 typedef void* data;
00005 
00007 typedef struct list {
00008   struct list* next;
00009   data  obj;
00010 } list;
00011 
00018 void free_list (bool data, list* l);
00019 
00025 list* prepend (data obj, list* l);
00026 
00031 unsigned int length (const list* l);
00032 
00038 data hd (const list* l);
00039 
00046 list* tl (list* l);
00047 
00054 data nth (unsigned int n, const list* l);
00055 
00061 list* rev (list* l);
00062 
00068 list* append (list* l1, list* l2);
00069 
00074 bool mem (const data e, const list* l);
00075 
00081 void map (data (*f)(data), list* l);
00082 
00084 typedef void* val;
00085 
00092 val fold_left (val (*f)(val, data), val init, const list* l);
00093 
00098 void iter (void (*proc)(data), const list* l);
00099 
00104 bool for_all (bool (*pred)(data), const list* l);