New features and enhancements in version 9.0
Fixed problems in version 9.0x
Fixed problems in version 9.0
Fixed problems in version 9.1
x[.last][.last] = 1; x[.last - 1][.last - 2] = 2; x[.last + 1] //error: indexing beyond last elementAlso see the new headc and tailc functions.
// example 1: {"%6.0f"} ~ {"%#10.5g"} * 4 ~ {"%#15.10g"} // example 2: decl n = 10, as = {""} * n; // array of n empty strings //postfix multiplication different from postfix: {"a","b"} * 3 // {"a","b","a","b","a","b"} 3 * {"a","b"} // {"a","a","a","b","b","b"} "a" * 3 // "aaa" postfix onlyThe range function can create a sequence of numbers as an array of strings.Summary:string * int string repeats content string * array[c] array[c] each string in the array has string prefixed array[c] * string array[c] each string in the array has string suffixed int * array array[i * c] repeats first element, then second element, etc. array * int array[c * i] repeats array i times array[c] * array[d] array[c * d] each string concatenated in all possible ways array[c] .* array[c] array[c] each string concatenated
decl aa = {"one", 10, "two", 0, "four", <1>, "five", {1,2}}; println("aa[\"one\"]= ", aa["one"] ?: "false"); println("aa[\"two\"]= ", aa["two"] ?: "false"); println("aa[\"three\"]=", aa["three"] ?: "false"); println("aa[\"four\"]= ", aa["four"] ?: "false"); println("aa[\"five\"]= ", aa["five"] ?: "false");This example also uses: allow a ? a : c to be written as a ? : c. This makes for more readable code when a function has many options:
func(const options) { otherfunc(options["print"] ?: 0, options["stop_on_errors"] ?: 0, options["labels"] ?: {"a","b","c"}); } decl aa = {"one": 10, "two": 0, "four": <1>, "five": {1,2}}; // is equivalent to decl aa = {"one", 10, "two", 0, "four", <1>, "five", {1,2}}; // but the former may better reflect the intentionNote that the : can only be after odd elements, otherwise there is a compilation error
println("%cs", "&", "%rs", "\\\\\n", "%8.2f", {{"AAA",10.1,1/3},"\\hline",{"XAAA",12.1}});
replace({"aa","bb","cc","","dd"}, "", "|", "join"); // "aa|bb|cc||dd" replace("aa|bb|cc|dd", "|", "", "split"); // {"aa","bb","cc","dd"}
Ox version 9.10. © JA Doornik