add pic_for_each macro
This commit is contained in:
parent
47f4060086
commit
a4a63314a9
|
@ -18,6 +18,14 @@ pic_value pic_list(pic_state *, size_t, ...);
|
|||
pic_value pic_list_from_array(pic_state *, size_t, pic_value *);
|
||||
pic_value pic_make_list(pic_state *, int, pic_value);
|
||||
|
||||
#define PIC_FOR_EACH_HELPER(var, tmp, list) \
|
||||
for (pic_value tmp = (list); \
|
||||
pic_nil_p(tmp) ? false : ((var = pic_car(pic, tmp)), true); \
|
||||
tmp = pic_cdr(pic, tmp))
|
||||
|
||||
#define pic_for_each(var, list) \
|
||||
PIC_FOR_EACH_HELPER(var, GENSYM(pic_for_each_tmp__), list) \
|
||||
|
||||
int pic_length(pic_state *, pic_value);
|
||||
pic_value pic_reverse(pic_state *, pic_value);
|
||||
pic_value pic_append(pic_state *, pic_value, pic_value);
|
||||
|
|
Loading…
Reference in New Issue