Add micro utilities macros for handling list

This commit is contained in:
Patrick Pelissier committed 2022-03-16 22:29:56 +01:00
1 parent 823b1974bb
commit 7268551737
2 files changed
+23

No files matched your search

+13
View File
@@ -1675,6 +1675,19 @@ M_BEGIN_PROTECTED_CODE
#define M_FILTER_00(d, item) \
M_IF(M_PAIR_1 d(M_PAIR_2 d, item))(item, )
/* Return the HEAD element of a list */
#define M_HEAD(x, ...) x
/* Return the HEAD element of the tail of a list */
#define M_HEAD_2(x, y, ...) y
/* Return the tail sublist of the list (removing the HEAD) */
#define M_TAIL(x, ...) __VA_ARGS__
/* Return the tail sublist of the sublist (removing the 2 first elements) */
#define M_TAIL_2(x, y, ...) __VA_ARGS__
/* Concatene two arglists 'a' and 'b',
handling the case of empty arglist
handling the cases where the arglists are within parenthesis.