Higher order functions

In Gleam functions are values. They can be assigned to variables, passed to other functions, and anything else you can do with values.

Gleam では、関数は値です。変数に代入したり、他の関数に渡したり、値でできることは何でもできます。

Here the function add_one is being passed as an argument to the twice function.

ここでは、関数 add_onetwice 関数の引数として渡されています。

Notice the fn keyword is also used to describe the type of the function that twice takes as its second argument.

fn キーワードは、twice が第 2 引数として受け取る関数の型を表すためにも使われていることに注意してください。