diff options
Diffstat (limited to 'cppawk-cons.1')
-rw-r--r-- | cppawk-cons.1 | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/cppawk-cons.1 b/cppawk-cons.1 index fa286b9..6d701f6 100644 --- a/cppawk-cons.1 +++ b/cppawk-cons.1 @@ -92,7 +92,8 @@ cons \- Lisp-like data representation and control flow macros iota(\fIx\fP, \fIy\fP[, \fId\fP]) \fI// numbers from x to y, incrementing by\fP - uniq(\fIx\fP) \fI// list x deduplicated\fP + uniq(\fIx\fP) \fI// deduplicate x\fP + uniqual(\fIx\fP) \fI// deduplicate x with equal equality\fP mapcar(\fIf\fP, \fIx\fP) \fI// map list through function f\fP @@ -1766,6 +1767,54 @@ will be attained. iota(2.5, 2.5, -1) -> (2.5) .ft R +.SS Functions \fIuniq\fP and \fIuniqual\fP +.bk +Syntax: + +.ft B + uniq(\fIx\fP) + uniqual(\fIx\fP) +.ft R + +The +.B uniq +and +.B uniqual +functions return a list formed by removing the duplicates from list +.IR x . + +Whenever any item appears in +.I x +more than once, the resulting list will have only the first occurrence of +that item; the subsequent occurrences do not appear in the returned list. + +The +.B uniq +function identifies duplicates using native Awk equality, +using the raw representation of the objects as keys into an +associative array. + +The +.B uniqual +function uses the +.B equal +function's notion of equality. + +.B Examples: + +.ft B + uniq(nil) -> nil + uniq(list(1, 2, 1, 3, 2, 4, 2, 1, 5, 6, 5)) -> (1 2 3 4 5 6) + uniqual(nil) -> nil + uniqual(list(1, 2, 1, 3, 2, 4, 2, 1, 5, 6, 5)) -> (1 2 3 4 5 6): + uniq(list(1, 1.0)) -> (1) + uniq(list(1, "1.0")) -> (1 1.0) + uniqual(list(1, 1.0)) -> (1) + uniqual(list(1, "1.0")) -> (1) + uniq(list(box_str("abc"), "abc")) -> ("abc" "abc") + uniqual(list(box_str("abc"), "abc")) -> ("abc") +.ft R + .SH "SEE ALSO" cppawk(1) |