diff options
author | Louis Pilfold <louis@lpil.uk> | 2024-03-14 18:42:00 +0000 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2024-03-14 18:42:00 +0000 |
commit | 13ca259355e90d135c1d1055d4ed17ce2aa7c1e3 (patch) | |
tree | 092dd162f1bfdddccefd7c6d0093c8f9a1b06998 /src | |
parent | c60b93e35a042e269ae47f3da0c3040527a0eaaa (diff) | |
download | tour-13ca259355e90d135c1d1055d4ed17ce2aa7c1e3.tar.gz tour-13ca259355e90d135c1d1055d4ed17ce2aa7c1e3.zip |
Remove functions
Closes https://github.com/gleam-lang/language-tour/issues/52
Diffstat (limited to 'src')
4 files changed, 10 insertions, 10 deletions
diff --git a/src/content/chapter1_functions/lesson03_higher_order_functions/code.gleam b/src/content/chapter1_functions/lesson03_higher_order_functions/code.gleam index 4301ce5..43b6ca4 100644 --- a/src/content/chapter1_functions/lesson03_higher_order_functions/code.gleam +++ b/src/content/chapter1_functions/lesson03_higher_order_functions/code.gleam @@ -5,8 +5,8 @@ pub fn main() { io.debug(twice(1, add_one)) // Functions can be assigned to variables - let function = add_one - io.debug(function(100)) + let my_function = add_one + io.debug(my_function(100)) } fn twice(argument: Int, passed_function: fn(Int) -> Int) -> Int { diff --git a/src/content/chapter1_functions/lesson04_anonymous_functions/code.gleam b/src/content/chapter1_functions/lesson04_anonymous_functions/code.gleam index 2b037e0..e58659a 100644 --- a/src/content/chapter1_functions/lesson04_anonymous_functions/code.gleam +++ b/src/content/chapter1_functions/lesson04_anonymous_functions/code.gleam @@ -9,6 +9,6 @@ pub fn main() { io.debug(twice(1, fn(a) { a * 2 })) } -fn twice(argument: Int, function: fn(Int) -> Int) -> Int { - function(function(argument)) +fn twice(argument: Int, my_function: fn(Int) -> Int) -> Int { + my_function(my_function(argument)) } diff --git a/src/content/chapter1_functions/lesson06_generic_functions/code.gleam b/src/content/chapter1_functions/lesson06_generic_functions/code.gleam index 7b7c8db..db53efe 100644 --- a/src/content/chapter1_functions/lesson06_generic_functions/code.gleam +++ b/src/content/chapter1_functions/lesson06_generic_functions/code.gleam @@ -15,6 +15,6 @@ pub fn main() { } // The name `value` refers to the same type multiple times -fn twice(argument: value, function: fn(value) -> value) -> value { - function(function(argument)) +fn twice(argument: value, my_function: fn(value) -> value) -> value { + my_function(my_function(argument)) } diff --git a/src/content/chapter1_functions/lesson09_documentation_comments/code.gleam b/src/content/chapter1_functions/lesson09_documentation_comments/code.gleam index a84dce6..a29875f 100644 --- a/src/content/chapter1_functions/lesson09_documentation_comments/code.gleam +++ b/src/content/chapter1_functions/lesson09_documentation_comments/code.gleam @@ -8,12 +8,12 @@ pub type Never { /// Call a function twice with an initial value. /// -pub fn twice(argument: value, function: fn(value) -> value) -> value { - function(function(argument)) +pub fn twice(argument: value, my_function: fn(value) -> value) -> value { + my_function(my_function(argument)) } /// Call a function three times with an initial value. /// -pub fn thrice(argument: value, function: fn(value) -> value) -> value { - function(function(function(argument))) +pub fn thrice(argument: value, my_function: fn(value) -> value) -> value { + my_function(my_function(my_function(argument))) } |