Github user cestella commented on the issue:

    https://github.com/apache/metron/pull/823
  
    Slightly off topic (and not to dissuade from this good work which is much 
clearer), but as a bit of stellar code golf, I did find out that you can do 
this with `REDUCE`.
    
    For Numerical types (note val is mixed numeric types):
    ```
    [Stellar]>>> val := [1.2,2,3]
    [Stellar]>>> REDUCE(val, (ret, x) -> ret > x ? x : ret, GET_FIRST(val))
    1.2
    [Stellar]>>> MIN(val)
    1.2
    [Stellar]>>> REDUCE(val, (ret, x) -> ret < x ? x : ret, GET_FIRST(val))
    3
    [Stellar]>>> MAX(val)
    3
    ```
    
    For non-numeric but comparable types:
    ```
    [Stellar]>>> val := [ 'casey', 'stella' ]
    [Stellar]>>> MAX(val)
    stella
    [Stellar]>>> REDUCE(val, (ret, x) -> ret < x ? x : ret, GET_FIRST(val))
    stella
    [Stellar]>>> MIN(val)
    casey
    [Stellar]>>> REDUCE(val, (ret, x) -> ret > x ? x : ret, GET_FIRST(val))
    casey
    ```


---

Reply via email to