Init next project

This commit is contained in:
Jan-Niclas Loosen
2025-11-11 14:40:50 +01:00
parent edcf77fc18
commit fe33668b5f
43 changed files with 572 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
let a(x,y,z) {x}
in a(1,2,3)

View File

@@ -0,0 +1,15 @@
let
f1(b) {
if(b==0) then 0 else f1(b-1)
}
f2(a, b) {
if(a > b) then f1(a) else f1(b);
let g(c) {
a*b*c
} in g(a*b)
}
in
f1(10); f2(10, let max(a, b) {
if(a > b) then a else b
}
in max(20, 30))

View File

@@ -0,0 +1 @@
if 2 < x && x > 9 then 1 else 0

View File

@@ -0,0 +1,4 @@
let a(x) {x}
b(y) {y}
c(z) {z}
in a(1); b(2); c(3)

View File

@@ -0,0 +1,38 @@
let
fac(x) {
if (x == 1) then 1
else fac(x-1)*x
}
fac(x) {
if (x == 1) then 1
else fac(x-1)*x
}
fac(x) {
if (x == 1) then 1
else fac(x-1)*x
}
fac(x) {
if (x == 1) then 1
else fac(x-1)*x
}
fac(x) {
if (x == 1) then 1
else fac(x-1)*x
}
fac(x) {
if (x == 1) then 1
else fac(x-1)*x
}
fac(x) {
if (x == 1) then 1
else fac(x-1)*x
}
fac(x) {
if (x == 1) then 1
else fac(x-1)*x
}
fac(x) {
if (x == 1) then 1
else fac(x-1)*x
}
in fac(3)

View File

@@ -0,0 +1 @@
let n(a) {a} in n(5) + m(5) ; let m(a) {a+1} in m(5)

View File

@@ -0,0 +1 @@
if (2 && 7 > 2) then 1 else 0

View File

@@ -0,0 +1,7 @@
let func(a,b) {
do {
b = b + 1;
a = a - 1
} while ( a > 0 && b != a )
}
in func(10, 8)

View File

@@ -0,0 +1,12 @@
let ggT(a, b) {
if (a == b) then
a
else
do {
if (a > b) then
a = a - b
else
b = b - a
} while (a != b);
a
} in ggT(3528, 3780) // result should be 252

View File

@@ -0,0 +1,8 @@
let ggT(a, b) {
if (a == b) then
a
else if (a > b) then
ggT(a-b, b)
else
ggT(b-a, a)
} in ggT(3528, 3780) // result should be 252

View File

@@ -0,0 +1,3 @@
let f1(b) { if (b == 0) then 0 else f1(b-1) }
f2(a,b) { if (a > b) then f1(a) else f1(b) }
in f1(10); f2(10,-20)

View File

@@ -0,0 +1 @@
let m(a){a} in m(5);let m(b){b+1} in m(5)

View File

@@ -0,0 +1 @@
let n(a) {a} in n(5) ; let m(a) {a+1} in n(5) + m(5)

View File

@@ -0,0 +1 @@
if(true||true==true) then 1 else 0

View File

@@ -0,0 +1,3 @@
let g(a) {
a*a
} in g(5)

View File

@@ -0,0 +1,9 @@
let f1(b) {
if (b==0) then 0 else f1(b-1)
} in f1(10)
/*
f2(a,b) {
if (a>b) then f1(a) else f1(b)
}
in f1(10); f2(10,20)
*/

View File

@@ -0,0 +1,14 @@
let f1(b) {
if (b==0) then 0 else f1(b-1)
}
f2(a,b) {
if (a>b) then f1(a) else f1(b);
let g(c) {
a*b*c
}
in g(a*b)
}
in f1(10); f2(10, let max(a,b) {
if (a>b) then a else b
}
in max(20,30) )

View File

@@ -0,0 +1,4 @@
let func(a,b) {
a = b + 1
}
in func(10, 8)

View File

@@ -0,0 +1,9 @@
let func(a, b) {
let func(a, b) {
a * b
} in
do {
b = b + 1 * func(3, 1);
a = a - 1
} while ( a > 0 && b != a )
} in func(10, 8)

View File

@@ -0,0 +1,13 @@
let f(a, b) {
if (a == 0) then
2 + b
else
let g(a, c) {
a + c + b
} in 2 + g(a, b)
} g(c, d) {
if (c == 0) then
1 + d
else
c * f(c - 1, d)
} in f (2, 3); g (3, 2)

View File

@@ -0,0 +1,5 @@
let f(x, y) {
let g(x) {
y = x + 7
} in x = g(5); y
} in f(1, 2)

View File

@@ -0,0 +1,4 @@
let g(x, y) {
y = 3;
x
} in g(2)

View File

@@ -0,0 +1 @@
if (true) then 1 else 0

View File

@@ -0,0 +1 @@
if (true && false) then 1 else 0

View File

@@ -0,0 +1 @@
if (true || false) then 1 else 0

View File

@@ -0,0 +1 @@
if (1 > 2) then 1 else 0

View File

@@ -0,0 +1 @@
if (2 > 3 + 5) then 1 else 0

View File

@@ -0,0 +1 @@
if (1 > 2 || 3 < 5) then 1 else 0

View File

@@ -0,0 +1 @@
if (2 == 0 == false) then 1 else 0

View File

@@ -0,0 +1,2 @@
let square(x) { x*x }
in square(10)

View File

@@ -0,0 +1,4 @@
let mult(a,b) { a*b }
add(a,b) { let inc(a) { if (b!=0) then b=b-1;inc(a+1) else mult(a,1) }
in inc(a) }
in add(mult(2,3),add(4,5))

View File

@@ -0,0 +1,7 @@
let func(a,b) {
while ( a > 0 && b != a ) do {
b = b + 1;
a = a - 1
}
}
in func(10, 8)

View File

@@ -0,0 +1,3 @@
while (true) do {
3
}

View File

@@ -0,0 +1,8 @@
let wrapper(a, b) {
let ggt(noneSense) {
if a == b then a
else
if a > b then wrapper(a-b, b)
else wrapper(b-a, a)
} in ggt(0)
} in wrapper(21, 49)

View File

@@ -0,0 +1,9 @@
let wrapper(number, threshold) {
let square(x) {
if x*x > threshold
then x
else x*x
}
in square(number)
}
in wrapper(4, 10)