From 2dc39a5cbdd9c2654cfca4dee84018c2951b7f3f Mon Sep 17 00:00:00 2001 From: gingerBill Date: Thu, 29 Aug 2019 15:25:46 +0100 Subject: [PATCH] Improve demo.odin --- examples/demo/demo.odin | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/examples/demo/demo.odin b/examples/demo/demo.odin index cef814a56..fe390e5b0 100644 --- a/examples/demo/demo.odin +++ b/examples/demo/demo.odin @@ -544,6 +544,30 @@ parametric_polymorphism :: proc() { for v, i in array { assert(v == T(i*i)); } + + // Matrix multiplication + mul :: proc(a: [$M][$N]$T, b: [N][$P]T) -> (c: [M][P]T) { + for i in 0.. ! { fmt.println("I'm a diverging procedure"); @@ -931,6 +961,8 @@ diverging_procedures :: proc() { } deferred_procedure_associations :: proc() { + fmt.println("\n# deferred_procedure_associations"); + @(deferred_out=closure) open :: proc(s: string) -> bool { fmt.println(s); @@ -1030,6 +1062,10 @@ quaternions :: proc() { inline_for_statement :: proc() { fmt.println("\n#inline for statements"); + // 'inline for' works the same as if the 'inline' prefix did not + // exist but these ranged loops are explicitly unrolled which can + // be very very useful for certain optimizations + fmt.println("Ranges"); inline for x, i in 1..<4 { fmt.println(x, i);