From 70c3d6e3e421e28345fe10ea3efe3a00d503da7a Mon Sep 17 00:00:00 2001 From: Laria Carolin Chabowski Date: Fri, 15 Apr 2022 17:13:30 +0200 Subject: [PATCH] README: Fix spelling mistakes --- README.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index f16982b..3f7a6f1 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ The variable `_` is special: it can always be assigned to but will never actuall ### Strings -A string is surrounded by `"` quotes and can contain arbitrary bytes, with the exeption of `"` (terminates the string) and `\` (is used for escaping). +A string is surrounded by `"` quotes and can contain arbitrary bytes, with the exception of `"` (terminates the string) and `\` (is used for escaping). The following escape sequences are recognized: @@ -103,7 +103,7 @@ A dictionary (or dict for short) is created by placing `key -> value` pairs insi [->] # An empty dict ["foo" -> 1, "bar" -> 2] # A dictionary that maps the string "foo" to 1 and "bar" to 2. -As with lists, the comma (`,`) separator is optional and can also be replaced by newlines, semicolons. It's recommended to use commas when the dict is in one line and only linebreaks if it spans multiple lines. +As with lists, the comma (`,`) separator is optional and can also be replaced by newlines, semicolons. It's recommended to use commas when the dict is in one line and only line breaks if it spans multiple lines. It is an error to mix key-value pairs and list items in an `[]` bracket pair: @@ -157,7 +157,7 @@ This also means that instead of using `\` to break up a long function call into some-function ~[ argument-1 argument-2 - a-very-long-arugment-name + a-very-long-argument-name ~more-arguments (a nested function call) ] @@ -166,12 +166,12 @@ This also means that instead of using `\` to break up a long function call into some-function \ argument-1 \ argument-2 \ - a-very-long-arugment-name \ + a-very-long-argument-name \ ~more-arguments \ (a nested function call) # Equivalent to - some-function argument-1 argument-2 a-very-long-arugment-name ~more-arguments (a nested function call) + some-function argument-1 argument-2 a-very-long-argument-name ~more-arguments (a nested function call) Functions can be defined as simple functions or complex functions: @@ -238,7 +238,7 @@ Like a simple function, a complex function is written inside `{}` curly braces. print (add10 1) # Prints 11 print (add10 32) # Prints 42 -A function can contain multiple subfunctions, each with their own parameter list and their own body (everything after the parameter list up to the next parameter list or the eon of the function). When being called, the first subfunction, which parameter list mathes the arguments ist getting evaluated This can for example be used to provide a default argument: +A function can contain multiple subfunctions, each with their own parameter list and their own body (everything after the parameter list up to the next parameter list or the eon of the function). When being called, the first subfunction, which parameter list matches the arguments ist getting evaluated This can for example be used to provide a default argument: hello := { -> @@ -264,10 +264,10 @@ A parameter can not only be a variable name, it can also be a constant value tha factorial 5 # prints 120 (1 * 2 * 3 * 4 * 5) -A parameter list can also contain up to one expansion, a variable name preceeded by `~`. All remaining arguments are copied into the variable as a list. +A parameter list can also contain up to one expansion, a variable name preceded by `~`. All remaining arguments are copied into the variable as a list. print-many := { - -> # No arguemnts, nothing to print + -> # No arguments, nothing to print x ~more-args -> print x print-many ~more-args @@ -292,7 +292,7 @@ Parameters can also be tested further by providing a predicate: A parameter foll foo 2 # Prints: Called with even number 2 foo 3 # Prints: Called with odd number 3 -As a final piece, a parameter can also be a list parameter: Parameters surrounded by `[]` brackets form a single parameter that matches agains a list argument. The list is then matched against all parameters inside the brackets. All parameter types can be used here. As an example, here is a recursive implementation of the `map` operation. It creates a new list from an input list by applying a function to all values: +As a final piece, a parameter can also be a list parameter: Parameters surrounded by `[]` brackets form a single parameter that matches against a list argument. The list is then matched against all parameters inside the brackets. All parameter types can be used here. As an example, here is a recursive implementation of the `map` operation. It creates a new list from an input list by applying a function to all values: map := { _ [] -> # Handle empty list @@ -324,7 +324,7 @@ A simple assignment, like the ones we've used already assigns a value from the r foo = 123 print foo # Prints 123 -We've also already seen that you can also use `:=` instead of `=`, if you want to make sure the variable is a variabe local to the current function. +We've also already seen that you can also use `:=` instead of `=`, if you want to make sure the variable is a variable local to the current function. foo = 1 ({ @@ -339,7 +339,7 @@ We've also already seen that you can also use `:=` instead of `=`, if you want t # foo is still 2, as the variable `foo` inside the last immediately called function was a local one -The left habd side of an assignment can however be more than just variables. Like parameters of subfunctions, they can also be constants, list matches and can have predicates. +The left hand side of an assignment can however be more than just variables. Like parameters of subfunctions, they can also be constants, list matches and can have predicates. foo = [1 2 3 4] [first ~middle _] = foo @@ -362,4 +362,4 @@ The leftmost part must be a variable that contains a dictionary. Keys into that d = [->] d.foo = 1 # d.foo.bar = 2 # Would result in an error as d.foo is not a dictionary. - d.bar.baz = 3 # Valid, the missing dict d.bar is autmatically created + d.bar.baz = 3 # Valid, the missing dict d.bar is automatically created