# ELM applying two function in my function

**URL:** <https://discourse.elm-lang.org/t/elm-applying-two-function-in-my-function/7654>\
**Category:** Learn\
**Created:** [August 10, 2021, 3:40pm UTC](https://discourse.elm-lang.org/t/elm-applying-two-function-in-my-function/7654 "2021-08-10T15:40:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zack\_slm](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/zack_slm/32/4166_2.png) [@Zack\_slm](https://discourse.elm-lang.org/u/Zack_slm)\
**Post date:** [August 10, 2021, 3:40pm UTC](https://discourse.elm-lang.org/t/elm-applying-two-function-in-my-function/7654/1 "2021-08-10T15:40:28Z")

</div>

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](https://ellie-app.com/dY6QcvXzsCja1)

---

<div class="post-metadata">

**Author:** ![wolfadex](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/wolfadex/32/2461_2.png) [@wolfadex](https://discourse.elm-lang.org/u/wolfadex)\
**Post date:** [August 10, 2021, 4:56pm UTC](https://discourse.elm-lang.org/t/elm-applying-two-function-in-my-function/7654/2 "2021-08-10T16:56:49Z")

</div>

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](https://ellie-app.com/dY7YX45mJw7a1)

```elm
let
    filteredInputs = List.filter (\x -> x /= "") inputs
in
getPolishSumHelper filteredInputs []

```

or if you prefer to use parentheses you could write it as

```elm
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

```elm
getPolishSumHelper [] (List.filter (\x -> x /= "") inputs)

```

which could then be written using pipe `|>` as

```elm
inputs
    |> List.filter (\x -> x /= "")
    |> getPolishSumHelper []

```

which reads as

- given `input`
- first, filter out empty strings
- then use `getPolishSumHelper`

---

<div class="post-metadata">

**Author:** ![Zack\_slm](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/zack_slm/32/4166_2.png) [@Zack\_slm](https://discourse.elm-lang.org/u/Zack_slm)\
**Post date:** [August 11, 2021, 12:36pm UTC](https://discourse.elm-lang.org/t/elm-applying-two-function-in-my-function/7654/3 "2021-08-11T12:36:52Z")

</div>

thank you very much it’s very helpful

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/elm_lang/original/1X/50a05e53677a2c3b47776d7abd0f113eb50193a1.png) [@system](https://discourse.elm-lang.org/u/system)\
**Post date:** [August 21, 2021, 12:36pm UTC](https://discourse.elm-lang.org/t/elm-applying-two-function-in-my-function/7654/4 "2021-08-21T12:36:53Z")

</div>

Closed on August 21, 2021, 12:36pm UTC

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
