Frage

Why does this work:

iex(9)> Enum.filter(["lowks", "kian", "seong"], fn(x) -> x == "lowks" end)
["lowks"]

While this does not:

iex(5)> Enum.filter(String.split("low kian seong"), fn(x) -> x == "lowks" end) []

Is it because I am filtering the function ?

War es hilfreich?

Lösung

Unless I'm missing something, you have a typo in the second example. It should be lowks not low.

iex(1)> Enum.filter(String.split("lowks kian seong"), fn(x) -> x == "lowks" end)
["lowks"]
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top