diff options
Diffstat (limited to 'cppawk-include')
-rw-r--r-- | cppawk-include/cons-priv.h | 17 | ||||
-rw-r--r-- | cppawk-include/cons.h | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/cppawk-include/cons-priv.h b/cppawk-include/cons-priv.h index 97d410d..4482fa6 100644 --- a/cppawk-include/cons-priv.h +++ b/cppawk-include/cons-priv.h @@ -843,6 +843,23 @@ function __uniq(__lst, return __list_end(__out) } +function __uniqual(__lst, + __out, __item, __itemeq, __seen) +{ + __out = __list_begin(); + + __dolist(__item, __lst) { + __itemq = __equalize(__item) + if (__itemq in __seen) + continue + __seen[__itemq] + __out = __list_add(__out, __item) + } + + return __list_end(__out) +} + + #if __have_indirect_functions function __mapcar(__fun, __lst, diff --git a/cppawk-include/cons.h b/cppawk-include/cons.h index 2cf579f..b91877d 100644 --- a/cppawk-include/cons.h +++ b/cppawk-include/cons.h @@ -83,6 +83,7 @@ #define butlast __butlast #define iota __iota #define uniq __uniq +#define uniqual __uniqual #define mapcar __mapcar #define mappend __mappend |