Search in sources :

Example 1 with Iterate

use of primal.fp.Funs.Iterate in project suite by stupidsing.

the class FunCreatorTest method testObject.

@Test
public void testObject() {
    Int_Int inc = i -> i + 1;
    Iterate<FunExpr> fun = i -> f.object(inc).invoke("apply", i);
    assertEquals(3, LambdaInstance.of(Int_Int.class, fun).newFun().apply(2));
}
Also used : Reference(suite.node.Reference) Suite(suite.Suite) BaseOp(suite.node.io.BaseOp) Dump(suite.inspect.Dump) PrintlnFunExpr(suite.jdk.gen.FunExprM.PrintlnFunExpr) Fun(primal.fp.Funs.Fun) Source(primal.fp.Funs.Source) IntSource(primal.primitive.IntPrim.IntSource) Iterate(primal.fp.Funs.Iterate) ProfileFunExpr(suite.jdk.gen.FunExprM.ProfileFunExpr) Tree(suite.node.Tree) Node(suite.node.Node) Test(org.junit.jupiter.api.Test) BiPredicate(java.util.function.BiPredicate) LambdaInstance(suite.jdk.lambda.LambdaInstance) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) Map(java.util.Map) Type(org.apache.bcel.generic.Type) Int_Int(primal.primitive.Int_Int) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) FunExpr(suite.jdk.gen.FunExpression.FunExpr) Int(suite.node.Int) Flt_Flt(primal.primitive.Flt_Flt) LambdaInterface(suite.jdk.lambda.LambdaInterface) Int_Int(primal.primitive.Int_Int) PrintlnFunExpr(suite.jdk.gen.FunExprM.PrintlnFunExpr) ProfileFunExpr(suite.jdk.gen.FunExprM.ProfileFunExpr) FunExpr(suite.jdk.gen.FunExpression.FunExpr) Test(org.junit.jupiter.api.Test)

Aggregations

Map (java.util.Map)1 BiPredicate (java.util.function.BiPredicate)1 Type (org.apache.bcel.generic.Type)1 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)1 Assertions.assertTrue (org.junit.jupiter.api.Assertions.assertTrue)1 Test (org.junit.jupiter.api.Test)1 Fun (primal.fp.Funs.Fun)1 Iterate (primal.fp.Funs.Iterate)1 Source (primal.fp.Funs.Source)1 Flt_Flt (primal.primitive.Flt_Flt)1 IntSource (primal.primitive.IntPrim.IntSource)1 Int_Int (primal.primitive.Int_Int)1 Suite (suite.Suite)1 Dump (suite.inspect.Dump)1 PrintlnFunExpr (suite.jdk.gen.FunExprM.PrintlnFunExpr)1 ProfileFunExpr (suite.jdk.gen.FunExprM.ProfileFunExpr)1 FunExpr (suite.jdk.gen.FunExpression.FunExpr)1 LambdaInstance (suite.jdk.lambda.LambdaInstance)1 LambdaInterface (suite.jdk.lambda.LambdaInterface)1 Int (suite.node.Int)1