diff --git a/docs/user_docs/support/faq-kcl.md b/docs/user_docs/support/faq-kcl.md index 1684ca55..b116ef96 100644 --- a/docs/user_docs/support/faq-kcl.md +++ b/docs/user_docs/support/faq-kcl.md @@ -2415,4 +2415,27 @@ cc: aahash: 1992c2ef118972b9c3f96c3f74cdd1a5 bbhash: 5c71751205373815a9f2e022dd846758 cchash: 5c71751205373815a9f2e022dd846758 +``` + +## 54. How to deduplicate str lists? + +You can use KCL to deduplicate lists of strings as shown in the code snippet below: + +```python +to_set = lambda items: [str] { + [item for item in {item = None for item in items}] +} + +data = to_set(["aa", "bb", "bb", "cc"]) +dataIsUnique = isunique(data) +``` + +After running above script, You'll get output like this: + +```bash +data: +- aa +- bb +- cc +dataIsUnique: true ``` \ No newline at end of file