diff --git a/docs/Getting-Started.md b/docs/Getting-Started.md index 1ea874713..de42cdb4c 100644 --- a/docs/Getting-Started.md +++ b/docs/Getting-Started.md @@ -174,5 +174,3 @@ Here is another example with a few function signatures: new(func(string) int), ) ``` - -* Next: [Operator Overloading](Operator-Overloading.md) diff --git a/docs/Internals.md b/docs/Internals.md index d3aa8e3f6..593af1321 100644 --- a/docs/Internals.md +++ b/docs/Internals.md @@ -76,5 +76,3 @@ fib(42) Will be replaced with the result of `fib`(42)` on the compile step. [ConstExpr Example](https://pkg.go.dev/github.com/antonmedv/expr?tab=doc#ConstExpr) - -* Next: [Tips](Tips.md) diff --git a/docs/Language-Definition.md b/docs/Language-Definition.md index 450c351e4..3dc947e0b 100644 --- a/docs/Language-Definition.md +++ b/docs/Language-Definition.md @@ -42,12 +42,11 @@ Map - {a: 1, b: 2, c: 3} + {a: 1, b: 2, c: 3} - Nil + Nil nil @@ -116,11 +115,11 @@ d> Examples: -```c++ +```expr user.Age in 18..45 and user.Name not in ["admin", "root"] ``` -```c++ +```expr foo matches "^[A-Z].*" ``` @@ -143,7 +142,7 @@ The `?.` operator can be used to access a field of a struct or an item of a map without checking if the struct or the map is `nil`. If the struct or the map is `nil`, the result of the expression is `nil`. -```c++ +```expr author?.User?.Name ``` @@ -152,7 +151,7 @@ author?.User?.Name The `??` operator can be used to return the left-hand side if it is not `nil`, otherwise the right-hand side is returned. -```c++ +```expr author?.User?.Name ?? "Anonymous" ``` @@ -162,7 +161,7 @@ The slice operator `[:]` can be used to access a slice of an array. For example, variable `array` is `[1, 2, 3, 4, 5]`: -```c++ +```expr array[1:4] == [2, 3, 4] array[1:-1] == [2, 3, 4] array[:3] == [1, 2, 3] @@ -173,34 +172,12 @@ array[:] == array ## Built-in Functions - - - - - - -
- all()
- any()
- one()
- none()
-
- map()
- filter()
- count()
-
- len()
- abs()
- int()
- float()
-
- ### all(array, predicate) Returns **true** if all elements satisfies the [predicate](#predicate). If the array is empty, returns **true**. -```c++ +```expr all(Tweets, {.Size < 280}) ``` @@ -214,7 +191,7 @@ If the array is empty, returns **false**. Returns **true** if _exactly one_ element satisfies the [predicate](#predicate). If the array is empty, returns **false**. -```c++ +```expr one(Participants, {.Winner}) ``` @@ -237,7 +214,7 @@ Returns new array by filtering elements of the array by [predicate](#predicate). Returns the number of elements what satisfies the [predicate](#predicate). Equivalent to: -```c++ +```expr len(filter(array, predicate)) ``` @@ -253,7 +230,7 @@ Returns the absolute value of a number. Returns the integer value of a number or a string. -```c++ +```expr int("123") == 123 ``` @@ -266,19 +243,19 @@ Returns the float value of a number or a string. The predicate is an expression that accepts a single argument. To access the argument use the `#` symbol. -```c++ +```expr map(0..9, {# / 2}) ``` If items of the array is a struct or a map, it is possible to access fields with omitted `#` symbol (`#.Value` becomes `.Value`). -```c++ +```expr filter(Tweets, {len(.Value) > 280}) ``` Braces `{` `}` can be omitted: -```c++ +```expr filter(Tweets, len(.Value) > 280) ``` diff --git a/docs/Operator-Overloading.md b/docs/Operator-Overloading.md index e03027c0a..83884103c 100644 --- a/docs/Operator-Overloading.md +++ b/docs/Operator-Overloading.md @@ -50,5 +50,3 @@ func (Env) Sub(a, b time.Time) time.Duration { return a.Sub(b) } **Expr** uses functions from `Env` for operator overloading. If types of operands match types of a function, the operator will be replaced with a function call. - -* Next: [Visitor and Patch](Visitor-and-Patch.md) diff --git a/docs/Visitor-and-Patch.md b/docs/Visitor-and-Patch.md index 7fe89024e..419a60eee 100644 --- a/docs/Visitor-and-Patch.md +++ b/docs/Visitor-and-Patch.md @@ -142,5 +142,3 @@ func (p *stringerPatcher) Visit(node *ast.Node) { } ``` - -* Next: [Internals](Internals.md)