aboutsummaryrefslogtreecommitdiff
path: root/examples/25-function-expression-infer-param-type
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2025-02-02 20:13:05 +0000
committerMichael Williamson <mike@zwobble.org>2025-02-02 20:13:20 +0000
commit89394d0fab076765b637b0fe643d8f8950639817 (patch)
tree6852b4f81fd7f7812bb208df52b4e0cc8b1bcbdf /examples/25-function-expression-infer-param-type
parent67f010c93b11744b1f2f1c9403fd1e8d2b888acb (diff)
Add int arithmetic example
Diffstat (limited to 'examples/25-function-expression-infer-param-type')
-rw-r--r--examples/25-function-expression-infer-param-type/shed-examples.json59
-rw-r--r--examples/25-function-expression-infer-param-type/shed.json58
-rw-r--r--examples/25-function-expression-infer-param-type/src/HelloWorld.shed8
3 files changed, 25 insertions, 0 deletions
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"));
+}