Github user jjmeyer0 commented on a diff in the pull request: https://github.com/apache/metron/pull/814#discussion_r147556465 --- Diff: metron-stellar/stellar-common/README.md --- @@ -100,6 +102,28 @@ In the core language functions, we support basic functional programming primitiv * `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 `REDUCE([ 1, 2, 3], (sum, x) -> sum + x, 0 )` returns `6` +### Stellar Language Match Expression + +Stellar provides the capability to write match expressions, which are similar to switch statements commonly found in c like languages, but more like +Scala's match. + +The syntax is: +* `match{ logical_expression1 : evaluation expression1, logical_expression2 : evaluation_expression2` : A match expression with no default +* `match{ logical_expression1 : evaluation expression1, logical_expression2 : evaluation_expression2, default : default_expression}` : A match expression with a default expression + +Where: + +* `logical_expression` is a Stellar expression that evaluates to true or false. For instance `var > 0` or `var > 0 AND var2 == 'foo'` --- End diff -- It seems as if the below stellar always throws an exception. Is it by design that `default` clauses are always evaluated? If so can you mention that here? ``` foo := 500 match{ foo < 100 : THROW('oops'), foo > 200 : 'ok', default : THROW('exception thrown') } ```
---