Mixed pattern matching

blackened
Thu, 22 Sep 2022 10:34:07 +0000
Questions / Help

Suppose I have these two lists: list1 = ["one", "two", "three"] and list2 = ["two", "four", "three"].

What would be an Elixir-way function to achieve the following: each item of list 2 will be compared to list 1 in the following way: if the item with the same index is the same, then output :yes, if not, if the item is at list 1, then output :ok, else, output :no.

So, for the above example, the output shall be: [:ok, :no, :yes]

5 posts - 3 participants