hello, i try to apply two function first filter and then applying my function i have a problem in line 39 thank you for helping : https://ellie-app.com/dY6QcvXzsCja1
It looks like you’re trying to use a comma to separate your functions as well as reuse the inputs
value in both functions. This won’t work firstly because a comma doesn’t have any meaning in Elm. The second issue is that Elm doesn’t mutate values. What you likely want is something closer to https://ellie-app.com/dY7YX45mJw7a1
let
filteredInputs = List.filter (\x -> x /= "") inputs
in
getPolishSumHelper filteredInputs []
or if you prefer to use parentheses you could write it as
getPolishSumHelper (List.filter (\x -> x /= "") inputs) []
If you wanted to make this more like idiomatic Elm, I would reorder the arguments in getPolishSumHelper
so that the input is the last argument. This would then make your code look more like
getPolishSumHelper [] (List.filter (\x -> x /= "") inputs)
which could then be written using pipe |>
as
inputs
|> List.filter (\x -> x /= "")
|> getPolishSumHelper []
which reads as
- given
input
- first, filter out empty strings
- then use
getPolishSumHelper
thank you very much it’s very helpful
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.