From 89394d0fab076765b637b0fe643d8f8950639817 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 2 Feb 2025 20:13:05 +0000 Subject: Add int arithmetic example --- .../25-function-expression-infer-param-type/shed-examples.json5 | 9 +++++++++ examples/25-function-expression-infer-param-type/shed.json5 | 8 ++++++++ .../25-function-expression-infer-param-type/src/HelloWorld.shed | 8 ++++++++ 3 files changed, 25 insertions(+) create mode 100644 examples/25-function-expression-infer-param-type/shed-examples.json5 create mode 100644 examples/25-function-expression-infer-param-type/shed.json5 create mode 100644 examples/25-function-expression-infer-param-type/src/HelloWorld.shed (limited to 'examples/25-function-expression-infer-param-type') diff --git a/examples/25-function-expression-infer-param-type/shed-examples.json5 b/examples/25-function-expression-infer-param-type/shed-examples.json5 new file mode 100644 index 00000000..81fa6d68 --- /dev/null +++ b/examples/25-function-expression-infer-param-type/shed-examples.json5 @@ -0,0 +1,9 @@ +{ + examples: [ + { + project: ".", + bin: "hello-world", + expectedOutput: "hello, world\nworld, hello", + }, + ], +} diff --git a/examples/25-function-expression-infer-param-type/shed.json5 b/examples/25-function-expression-infer-param-type/shed.json5 new file mode 100644 index 00000000..a6c8e563 --- /dev/null +++ b/examples/25-function-expression-infer-param-type/shed.json5 @@ -0,0 +1,8 @@ +{ + bins: [ + { + name: "hello-world", + mainNamespace: "HelloWorld", + }, + ], +} diff --git a/examples/25-function-expression-infer-param-type/src/HelloWorld.shed b/examples/25-function-expression-infer-param-type/src/HelloWorld.shed new file mode 100644 index 00000000..e91bc5e0 --- /dev/null +++ b/examples/25-function-expression-infer-param-type/src/HelloWorld.shed @@ -0,0 +1,8 @@ +pub fun main() ! Io -> Unit { + printHelloWorld!(fn (left, right) { left + ", " + right + "\n" }); + printHelloWorld!(fn (left, right) { right + ", " + left + "\n" }) +} + +fun printHelloWorld(combine: fn (String, String) -> String) !Io -> Unit { + print!(combine("hello", "world")); +} -- cgit v1.2.3