/* Learn an as of yet unnamed language in Y Minutes */ /* A functional programming language with immutable variables, first-class functions, and pattern matching */ /* We've got numbers */ x : 42; /* also the ability to assign values to variables */ y : 3.14; z : 0; /* We've got identifiers */ this_is_a : "test"; flag : true; value : false; /* We've got basic mathematical operators */ sum : x + y; diff : x - y; prod : x * y; quot : x / y; /* We've got pattern matching case statements! */ result : case x of 42 : "correct" _ : "wrong"; /* Of course, there are functions */ double : x -> x * 2; add : x y -> x + y; func_result : double 5; /* And immutable tables, kinda inspired by Lua's tables */ table : {1, 2, 3, name: "Alice", age: 30}; first : table[1]; table_name : table.name; /* A boring standard library */ square : x -> x * x; mapped : map @double 5; composed : compose @double @square 3; /* Special functions for IO all start with .. */ ..out "Hello from the scripting language!"; ..out x; ..out func_result; ..out result; ..out first; ..out table_name; ..out mapped; ..out composed; /* There's a baked in IO function for performing assertions */ ..assert x = 42; ..assert func_result = 10; ..assert result = "correct"; ..assert first = 1; ..assert table_name = "Alice"; ..assert mapped = 10; ..assert composed = 18; ..assert 5 > 3; /* ..assert should work with any kinda operators */ ..out "Learn Scripting Language tutorial completed!";