(=>)
token in an expression. Lambda expression will work on posts, comments, or labels.Lambda expression pattern:
[variable name] => [expression]
Example:
label => label.name == "Technology"
In order to use lambda expression, we need to use available aggregate operator that can take lambda expression as an operand (lambda operator). Lambda operators is set of aggregate operations that allow to pass lambda expression as an operand. Lambda operator take two operand. Left operand is a set of data that can be posts, comments, or labels. Right operand is lambda expression.
Lambda operation pattern:
[set of data] [lambda operator] ([lambda expression])
Example:
data:post.labels any (label => label.name == "Blogger")
data:post.labels
is a set of data,any
is lambda operator,(label => label.name == "Blogger")
is lambda expression.Below is list of available aggregate operators that can be used to operates lambda expression:
Operator | Description |
---|---|
any | Returns true if any item matches the rules on lambda expression (boolean) |
all | Returns true if all of the items in the set matches the rules on lambda expression (boolean) |
none | Returns true if none of the items in the set matches lambda expression (boolean) |
count | Returns the count of the items in the set which matches rules on lambda expression (number) |
first | Returns the first item which match lambda expression (data) |
filter, where | Returns all of items that matches rules on lambda expression (set of data) |
map, select | Returns a set containing each of the results in a new form applied by lambda expression (new set of data) |
No comments:
Post a Comment