Listen "Index 1: Piping, currying and the order of function parameters"
Episode Synopsis
In this episode, we discuss piping in Elm and Elixir, we discuss currying functions and we also talk a bit about why functions parameters go in different orders between Elm and Elixir, and how that works out in practice.
Tristan tries to read out some code examples. During the discussion on currying, he reads some javascript:
First, the uncurried, natural form:
function (x, y) {
return x + y;
}
and then, the curried javascript form:
function (x) {
return function (y) {
return x + y;
};
}
Later, in the discussion on function parameter order in Elixir vs Elm, he compares some Elm code in piped and unpiped form with some Elixir code in piped and unpiped form.
First, piped Elm:
getPeople source
|> List.filter (hasMinimumAge 20)
Second, unpiped Elm:
let
people = getPeople source
in
List.filter (hasMinimumAge 20) people
Next, piped Elixir:
getPeople source
|> Enum.filter(hasMinimumAge 20)
And finally, unpiped Elixir:
people = getPeople source
Enum.filter(people, hasMinimumAge 20)
Reach out to Nadinda on Twitter/Instagram @nadindadev and Tristan on Twitter @tmcll.
Thanks, see you next time!
Tristan tries to read out some code examples. During the discussion on currying, he reads some javascript:
First, the uncurried, natural form:
function (x, y) {
return x + y;
}
and then, the curried javascript form:
function (x) {
return function (y) {
return x + y;
};
}
Later, in the discussion on function parameter order in Elixir vs Elm, he compares some Elm code in piped and unpiped form with some Elixir code in piped and unpiped form.
First, piped Elm:
getPeople source
|> List.filter (hasMinimumAge 20)
Second, unpiped Elm:
let
people = getPeople source
in
List.filter (hasMinimumAge 20) people
Next, piped Elixir:
getPeople source
|> Enum.filter(hasMinimumAge 20)
And finally, unpiped Elixir:
people = getPeople source
Enum.filter(people, hasMinimumAge 20)
Reach out to Nadinda on Twitter/Instagram @nadindadev and Tristan on Twitter @tmcll.
Thanks, see you next time!