Compare commits

...

2 Commits

Author SHA1 Message Date
pl@gohorb.ba-horb.de
9c519d0746 new file: resources/AllgemeinTest/Uncurrier.jav
All checks were successful
Build and Test with Maven / Build-and-test-with-Maven (push) Successful in 2m28s
new file:   resources/AllgemeinTest/UncurrierMain.jav
	modified:   resources/KPSPresentation/Faculty.jav
	modified:   resources/KPSPresentation/Main.jav
	new file:   resources/KPSPresentation/MainFaculty.jav
	new file:   resources/KPSPresentation/MainOL.jav
	modified:   resources/KPSPresentation/MatrixOP.jav
	modified:   resources/KPSPresentation/OL.jav
	modified:   src/test/java/KPSPresentation.java
2025-10-10 10:38:05 +02:00
pl@gohorb.ba-horb.de
db040d590e modified: Main.jav
All checks were successful
Build and Test with Maven / Build-and-test-with-Maven (push) Successful in 1m37s
modified:   Matrix.jav
	modified:   ../../src/test/java/KPSPresentation.java
2025-09-24 18:35:19 +02:00
10 changed files with 130 additions and 28 deletions

View File

@@ -0,0 +1,7 @@
public class Uncurrier{
uncurry (f){
return x -> f.apply(x);}
uncurry (f){
return (x, y) -> f.apply(x).apply(y);
}
}

View File

@@ -0,0 +1,9 @@
import Uncurrier;
import java.lang.Integer;
class UncurrierMain {
meth(y) {
var uc = new Uncurrier() ;
uc.uncurry(x -> x+1);
}
}

View File

@@ -1,13 +1,15 @@
import java.lang.Integer;
import java.lang.Float;
import java.lang.Double;
import java.lang.System;
import java.io.PrintStream;
public class Faculty {
public Fun1$$<Integer, Integer> fact = (x) -> {
public Fun1$$<Double, Double> fact = (x) -> {
if (x == 1) {
return 1;
}
else {
return x * (fact.apply(x-1));
return x * (fact.apply(x-1.0));
}
};
@@ -15,4 +17,9 @@ public class Faculty {
return fact.apply(x);
}
public static void main(x) {
var f = new Faculty();
var intRes = f.getFact(3.0);
System.out.println(intRes);
}
}

View File

@@ -7,9 +7,12 @@ import java.lang.Integer;
import fst;
import Id;
import OLMain;
import Fac
import Fac;
import Faculty;
import applyLambda;
import java.util.Vector;
import Matrix;
import MatrixOP;
public class Main {
public static main(x) {
@@ -82,7 +85,7 @@ public class Main {
//Matrix m3 = m1.mul(vv1);
Matrix m3 = m1.mul(m2);
System.out.println(m1.toString() + " * " + m2.toString() + " = " + m3.toString());
/*
//MatrixOP
MatrixOP mOp1 = new MatrixOP();
mOp1.addElement(v1);
@@ -91,13 +94,13 @@ public class Main {
System.out.println(m1.toString() + " * " + m2.toString() + " = " + mOp2.toString());
}
}
/*
public class MainBug {
public static main(x) {
System.out.println(new fst().main(5));
//System.out.println(new FacultyBug().getFact(3));
}
}
*/
}
}

View File

@@ -0,0 +1,11 @@
import java.lang.System;
import java.io.PrintStream;
import Faculty;
public class MainFaculty {
public static void main(x) {
//var f = new Faculty();
//var intRes = f.getFact(3);
//System.out.println(intRes);
}
}

View File

@@ -0,0 +1,20 @@
import java.lang.String ;
import java.lang.System;
import java.io.PrintStream;
import java.lang.Float;
import OL2;
class MainOL {
public static main(x) {
var ol = new OL2();
//the function main is applied to an integer
//var res1 = ol.m2(2);
//the main is applied to a double
//System.out.println(ol.m2(2.0));
//System.out.println(ol.m2("Hallo").toString());
var res2 = ol.m2("Hallo").toString();
System.out.println(res2);
}
}

View File

@@ -5,10 +5,10 @@ import java.lang.Boolean;
public class Matrix extends Vector<Vector<Integer>> {
Matrix () {
public Matrix () {
}
Matrix(vv) {
public Matrix(vv) {
var i = 0;
while(i < vv.size()) {
this.add(vv.elementAt(i));
@@ -17,7 +17,7 @@ public class Matrix extends Vector<Vector<Integer>> {
}
mul(java.util.Vector<? extends java.util.Vector<? extends java.lang.Integer>> m) {
mul(m) {
var ret = new Matrix();
var i = 0;
while(i < size()) {

View File

@@ -1,14 +1,17 @@
import java.util.Vector;
import java.lang.Integer;
import java.lang.Byte;
//import java.lang.Byte;
import java.lang.Boolean;
import java.lang.String;
import java.lang.System;
import java.io.PrintStream;
public class MatrixOP extends Vector<Vector<Integer>> {
MatrixOP () {
public MatrixOP () {
}
MatrixOP(vv) {
public MatrixOP(vv) {
Integer i;
i = 0;
while(i < vv.size()) {
@@ -17,7 +20,7 @@ public class MatrixOP extends Vector<Vector<Integer>> {
}
}
Fun2$$<Vector<? extends Vector<? extends Integer>>, Vector<? extends Vector<? extends Integer>>, MatrixOP> mul = (m1, m2) -> {
mul = (m1, m2) -> {
var ret = new MatrixOP();
var i = 0;
while(i < m1.size()) {
@@ -39,4 +42,23 @@ public class MatrixOP extends Vector<Vector<Integer>> {
}
return ret;
};
public static main(x) {
var vv = new Vector<Vector<Integer>>();
var v1 = new Vector<Integer> ();
v1.addElement(2);
v1.addElement(2);
var v2 = new Vector<Integer> ();
v2.addElement(3);
v2.addElement(3);
//MatrixOP
MatrixOP mOp1 = new MatrixOP();
mOp1.addElement(v1);
mOp1.addElement(v2);
MatrixOP mOp2 = mOp1.mul.apply(mOp1, mOp1);
System.out.print(mOp1); System.out.print(" * "); System.out.print(mOp1); System.out.print(" = "); System.out.println(mOp2);
//System.out.print(mOp1 + " * " + mOp1 + " = " + mOp2);
}
}
}

View File

@@ -3,28 +3,31 @@ import java.lang.Integer;
import java.lang.Double;
import java.lang.Boolean;
import java.lang.Object;
import java.lang.System;
import java.io.PrintStream;
class OL {
public class OL1 {
m(x) { return x + x; }
m1( x) { return x + x; }
m(x) { return x || x; }
m1(x) { return x || x; }
}
}
class OLMain {
public class OL2 {
main(x) {
m2(x) {
var ol;
ol = new OL();
return ol.m(x);
ol = new OL1();
return ol.m1(x);
}
}
}

View File

@@ -69,6 +69,11 @@ public class KPSPresentation {
testAlgo("OL");
}
@Test
public void MainOLTest() throws Exception {
testAlgo("MainOL");
}
@Test
public void FacTest() throws Exception {
testAlgo("Fac");
@@ -80,12 +85,27 @@ public class KPSPresentation {
}
@Test
public void Lambda() throws Exception {
public void MainFacultyTest() throws Exception {
testAlgo("MainFaculty");
}
@Test
public void LambdaTest() throws Exception {
testAlgo("Lambda");
}
@Test
public void applyLambda() throws Exception {
public void applyLambdaTest() throws Exception {
testAlgo("applyLambda");
}
@Test
public void MatrixTest() throws Exception {
testAlgo("Matrix");
}
@Test
public void MatrixOPTest() throws Exception {
testAlgo("MatrixOP");
}
}