// Example Baba Yaga Program // Demonstrates core language features // Variables and basic operations x : 42; y : x + 8; message : "Hello, Baba Yaga!"; // Functions and currying add : a b -> a + b; multiply : a b -> a * b; addTen : add 10; // Higher-order functions with lists numbers : [1, 2, 3, 4, 5]; doubled : map (x -> x * 2) numbers; evens : filter (x -> x % 2 = 0) doubled; sum : reduce (acc x -> acc + x) 0 evens; // Pattern matching classify : n -> when n is 0 then "zero" 1 then "one" Int then when (n > 10) is true then "big" _ then "small" _ then "unknown"; // Error handling with Result types safeDivide : a b -> when b is 0 then Err "Division by zero" _ then Ok (a / b); // Table (object) operations person : { name: "Alice", age: 30, city: "New York" }; // Output results io.out "=== Baba Yaga Language Demo ==="; io.out ""; io.out "Basic values:"; io.out x; io.out y; io.out message; io.out ""; io.out "Function results:"; io.out (addTen 5); io.out (multiply 6 7); io.out ""; io.out "List operations:"; io.out doubled; io.out evens; io.out sum; io.out ""; io.out "Pattern matching:"; io.out (classify 0); io.out (classify 15); io.out (classify 3); io.out ""; io.out "Error handling:"; result1 : safeDivide 10 2; result2 : safeDivide 10 0; io.out result1; io.out result2; io.out ""; io.out "Table operations:"; io.out person; io.out ""; io.out "Demo complete!";