diff options
Diffstat (limited to 'js/scripting-lang/baba-yaga-c/turing_complete_demos/02_recursion_demo.txt')
-rw-r--r-- | js/scripting-lang/baba-yaga-c/turing_complete_demos/02_recursion_demo.txt | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/js/scripting-lang/baba-yaga-c/turing_complete_demos/02_recursion_demo.txt b/js/scripting-lang/baba-yaga-c/turing_complete_demos/02_recursion_demo.txt deleted file mode 100644 index 9d25b1c..0000000 --- a/js/scripting-lang/baba-yaga-c/turing_complete_demos/02_recursion_demo.txt +++ /dev/null @@ -1,24 +0,0 @@ -/* Recursion Demonstration */ - -..out "=== Recursion: Unlimited Computation Power ==="; - -/* Simple countdown */ -countdown : n -> when n is 0 then "zero" _ then countdown (n - 1); -count_result : countdown 3; -..assert count_result = "zero"; -..out "Countdown: reaches zero"; - -/* Factorial */ -fact : n -> when n is 0 then 1 _ then n * (fact (n - 1)); -fact5 : fact 5; -..assert fact5 = 120; -..out "Factorial(5) = 120"; - -/* Power function */ -pow : x n -> when n is 0 then 1 _ then x * (pow x (n - 1)); -pow_result : pow 2 5; -..assert pow_result = 32; -..out "Power(2, 5) = 32"; - -..out "---"; -..out "✅ Recursion enables unlimited computation depth"; \ No newline at end of file |