[
https://issues.apache.org/jira/browse/METRON-831?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15961863#comment-15961863
]
ASF GitHub Bot commented on METRON-831:
---------------------------------------
Github user jjmeyer0 commented on a diff in the pull request:
https://github.com/apache/incubator-metron/pull/517#discussion_r110519705
--- Diff: metron-platform/metron-common/README.md ---
@@ -73,6 +73,27 @@ Below is how the `==` operator is expected to work:
The `!=` operator is the negation of the above.
+## Stellar Language Lambda Expressions
+
+Stellar provides the capability to pass lambda expressions to functions
+which wish to support that layer of indirection. The syntax is:
+* `(named_variables) -> stellar_expression` : Lambda expression with named
variables
+ * For instance, the lambda expression which calls `TO_UPPER` on a named
argument `x` could be be expressed as `(x) -> TO_UPPER(x)`.
+* `var -> stellar_expression` : Lambda expression with a single named
variable, `var`
+ * For instance, the lambda expression which calls `TO_UPPER` on a named
argument `x` could be expressed as `x -> TO_UPPER(x)`. Note, this is more
succinct but equivalent to the example directly above.
+* `() -> stellar_expression` : Lambda expression with no named variables.
+ * If no named variables are needed, you may omit the named variable
section. For instance, the lambda expression which returns a constant `false`
would be `() -> false`
+
+where
+* `named_variables` is a comma separated list of variables to use in the
Stellar expression
+* `stellar_expression` is an arbitrary stellar expression
+
+
+In the core language functions, we support basic functional programming
primitives such as
+* `MAP` - Applies a lambda expression over a list of input. For instance
`MAP([ 'foo', 'bar'], (x) -> TO_UPPER(x) )` returns `[ 'FOO', 'BAR' ]`
+* `FILTER` - Filters a list by a predicate in the form of a lambda
expression. For instance `FILTER([ 'foo', 'bar'], (x ) -> x == 'foo' )`
returns `[ 'foo' ]`
+* `REDUCE` - Applies a function over a list of input. For instance `MAP([
'foo', 'bar'], (x) -> TO_UPPER(x) )` returns `[ 'FOO', 'BAR' ]`
--- End diff --
I believe you may have forgotten to update your copy/paste for the `REDUCE`
documentation.
> Add lambda expressions and rudimentary functional programming primitives to
> Stellar
> -----------------------------------------------------------------------------------
>
> Key: METRON-831
> URL: https://issues.apache.org/jira/browse/METRON-831
> Project: Metron
> Issue Type: Improvement
> Reporter: Casey Stella
>
> To enable use-cases where the user may want to do simple iteration, we can
> expose simple functional primitives such as:
> * MAP
> * REDUCE
> * FILTER
> To fully support this, we will need lambda expressions as arguments to these
> functions.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)