Join two list into on list without duplication

Hi all,

How to join 2 list into one list by excluding duplicate elements in the list?

@cocreature @bernhard @Julius_William

module Main where

import Daml.Script
import qualified DA.List

setup : Script ()
setup = script do
  let list1 = [1, 3, 5, 7, 9]
  let list2 = [2, 3, 5, 7, 11]
  let merged = DA.List.dedup $ list1 <> list2
  debug $ merged
2 Likes

Thanks @Gary_Verhaegen

@Gary_Verhaegen Do you know how can we check if an element is present in the list or not?

Assuming your element has equality defined, the elem function does that.