Package org.eolang

Class ExprReduce<T>

  • Type Parameters:
    T - Type of arguments that are going to be reduced
    All Implemented Interfaces:
    Expr

    public final class ExprReduce<T>
    extends Object
    implements Expr
    Builds a phi performing reduction operation on varargs parameter.

    Definition example:

         final VarargExpr<Long> expr = new VarargExpr<>(
             "x",
             new ExrpReduce.Args(
                 "plus",
                 Long.class,
                 Long::sum,
                 x -> ""
             )
         );
     
    Since:
    1.0
    • Constructor Detail

      • ExprReduce

        public ExprReduce​(String param,
                          BinaryOperator<T> reduction,
                          ExprReduce.Args<T> arguments)
        Ctor.
        Parameters:
        param - Name of parameter with varargs
        reduction - Reduction operation on consecutive varags
        arguments - Arguments storing and parsing object
        Since:
        1.0
    • Method Detail

      • get

        public Phi get​(Phi rho)
        Description copied from interface: Expr
        Get the object.
        Specified by:
        get in interface Expr
        Parameters:
        rho - The \rho of this expression (the parent of it)
        Returns:
        The Phi calculated