Hi Alex, Perhaps this helps?
$ elm repl ---- elm-repl 0.17.1 ----------------------------------------------------------- :help for help, :exit to exit, more at < https://github.com/elm-lang/elm-repl> -------------------------------------------------------------------------------- > a = [1, 2, 3, 4, 5] [1,2,3,4,5] : List number > isOdd n = (n % 2 == 1) <function:_user$project$Repl$isOdd> : Int -> Bool > odds = List.filter isOdd a [1,3,5] : List Int > doAction n = n + 1 <function:_user$project$Repl$doAction> : number -> number > List.map doAction odds [2,4,6] : List Int Here, I take a list of integers (in your case it would be records) and filter on just the ones I want (in this case, odd numbers). Then I use the `map` function to apply the `doAction` function to each. On Mon, Dec 26, 2016 at 6:40 AM, <[email protected]> wrote: > Hello, > I am new to elm syntax. I have a list of records with name and age. I want > to apply a test function to each record. The function takes one record as > input and returns a boolean value. Depending on True or false, I want to > take a specific action for each record. How can I implement this in elm? If > it was Python, I will just iterate over each item in the list and pass it > as a parameter to the function. > > > -- > You received this message because you are subscribed to the Google Groups > "Elm Discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
