about summary refs log tree commit diff stats
path: root/static_dispatch.mu
diff options
context:
space:
mode:
Diffstat (limited to 'static_dispatch.mu')
-rw-r--r--static_dispatch.mu21
1 files changed, 21 insertions, 0 deletions
diff --git a/static_dispatch.mu b/static_dispatch.mu
new file mode 100644
index 00000000..00160a2a
--- /dev/null
+++ b/static_dispatch.mu
@@ -0,0 +1,21 @@
+recipe test a:number -> b:number [
+  local-scope
+  load-ingredients
+  b <- add a, 1
+]
+
+recipe test a:number, b:number -> c:number [
+  local-scope
+  load-ingredients
+  c <- add a, b
+]
+
+recipe main [
+  local-scope
+  a:number <- test 3  # selects single-ingredient version
+  $print a, 10/newline
+  b:number <- test 3, 4  # selects double-ingredient version
+  $print b, 10/newline
+  c:number <- test 3, 4, 5  # prefers double- to single-ingredient version
+  $print c, 10/newline
+]