about summary refs log tree commit diff stats
path: root/js/scripting-lang/tests/turing-completeness/01_basic_proof.txt
blob: fa5ebe548e145f7dbcf1a2200a80471bf71df48d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* Basic Turing Completeness Proof */

..out "=== Baba Yaga: Basic Turing Completeness Proof ===";

/* Test 1: Conditional Logic */
cond_test : when 42 is 42 then "PASS" _ then "FAIL";
..assert cond_test = "PASS";
..out "1. Conditionals: PASS";

/* Test 2: Recursion */
factorial : n -> when n is 0 then 1 _ then n * (factorial (n - 1));
fact_result : factorial 4;
..assert fact_result = 24;
..out "2. Recursion: factorial(4) = 24";

/* Test 3: Data Structures */
data : {name: "test", value: 100, nested: {deep: true}};
deep_val : data.nested.deep;
..assert deep_val = true;
..out "3. Data: nested access works";

/* Test 4: Function Composition */
double : x -> x * 2;
add5 : x -> x + 5;
composed : double (add5 10);
..assert composed = 30;
..out "4. Composition: double(add5(10)) = 30";

/* Test 5: Higher-Order Functions */
apply : f x -> f x;
square : x -> x * x;
ho_result : apply @square 6;
..assert ho_result = 36;
..out "5. Higher-order: apply(square, 6) = 36";

..out "---";
..out "✅ RESULT: Turing Complete!";
..out "All computational requirements satisfied.";