I have a list of struct here [~e[0 0 * * 1-5 ], ~e[/10 * * * * *], ~e[0 */3 * * * *]] which is represented through sigil. I need to take one expression at a time and compare it against this function
I am not sure if I understand correctly, but if so, you are looking for Enum.map/2, or possibly Enum.any?/2 or Enum.all?/2, depending on what you want (map each entry to a boolean, or check if any/all of them matches)
Then the Enum.map solution above will return a list of booleans, one for each entry, but probably it’s more appropriate to use Enum.any?, which would give you a single true or false value depending on whether any of the entries matches or not.
Do you need to know if even just one of them matches? Then use Enum.any?
Or do you need to know if all of them match? Then use Enum.all?
Or do you need to map each of the entries to a true or false answer? Then either Enum.map as shown above or Enum.reduce to create a map of entry to boolean.
We just need to return true or false. I think we can’t use Enum.all? because it needed all true values. So if one expression doesn’t match it will return false. I think Enum.any works perfectly here for now.