Elm Functions Are Curried

TL;DR

In Elm, everything is about functions. Let’s explore Elm function curried property. This post is part of the functional language series, and it is based on a remarkable book Programming Elm Build Safe and Maintainable Front-End Applications by Jeremy Fairbank.

In the image above, we have Basketball.letter the function with three parameters, where first and second are functions. Elm has a feature where you do not need immediately set for Basketball.letter function all three parameters. This is called partial applying of function parameters.

We first call Basketball.letter with the Basketball.trials function as the first parameter, and the anonymous function where we for every Integer always return String that explains who is drazen. As we do not set the third parameter, drazen is a new function that accepts Integer and returns String.

In other we crate function with Basketball.trials and Basketball.position functions that we used in Why Elm does not have statements. drazen and other are functions that are curried from other functions.

Remember

  • curried functions
  • partial argument application
  • those two concepts are based on functional programming principles. Do not despair if they do not immediately stick with you. You will grasp them after you start using those concepts in your application that solves a real-world problem.

Originally published at https://blog.tentamen.eu on June 24, 2020.

--

--

--

Founder of Tentamen, software testing agency.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

LeetCode 1382 Balance A Binary Search Tree

My Learnings | Filecoin Conference Day 2.

How Japanese Network Engineer passed the English version of AWS Certified Solutions Architect…

The Shunting-yard Algorithm

Bug Magnet Story, You Can Not Buy This Fish! — Tentamen Software Testing Blog

Job Posting 2.0 — Recruit More Effectively By Describing A Typical Day at Work

I hack websites — 10 golden rules for full-stack beginners

Jenkins and Cron Jobs

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Karlo Smid

Karlo Smid

Founder of Tentamen, software testing agency.

More from Medium

A platform that allows its users to have a say in how their funds are managed.

Former Ukrainian finance minister Jaresko says cost to rebuild Ukraine “could be up to $1 trillion”

Ukraine-Russia Crisis: An overview of the sanctions imposed on Russia.

What are the different translators — Assembler, Compiler, Interpreter

What are the different translators — Assembler, Compiler, Interpreter | TechcyPro