aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorc+12023-05-12 11:49:12 -0400
committerc+12023-05-12 11:49:12 -0400
commit17d6e6a265c44569f4533e12cc04442013ab3b3e (patch)
tree25233a2ca455b220a6ecae4d46139a55fd8b100b /examples
parent07077e2974d74efaee109c9da3500ef86aeecd06 (diff)
nothing workds help
Diffstat (limited to 'examples')
-rw-r--r--examples/hello.halk10
1 files changed, 6 insertions, 4 deletions
diff --git a/examples/hello.halk b/examples/hello.halk
index e6dc1a4..690fb5e 100644
--- a/examples/hello.halk
+++ b/examples/hello.halk
@@ -7,7 +7,7 @@
let.hello -> 'hello, '; [variables must be given a value at declaration]
-let.PI => math/PI; [namespaces are accessed with a '/']
+let.PI => math:PI; [namespaces are accessed with a ':'']
[constants are denoted with a '=>']
fn.greeting,to -> { [functions defined with: `fn.<name>,<argument>,..., -> {<body>};`]
@@ -19,14 +19,16 @@ fn.greeting,to -> { [functions defined with
fn.sum_all._ -> { [variadic functions are possible with the reserved '_' argument,
which is treated as an array]
- return.foldl.+,0,_;
+ return.foldl.sum,0,_;
};
fn.fibonacci.n -> {
- if.or.(num=?.n, 0), (num=?.n, 1) -> { [functions ending in '?' should be predicates]
+ if.or.(=.n, 0), (=.n, 1) -> { [functions ending in '?' should be predicates]
return.1;
};
- return.+.(fibonacci. -.n, 1), (fibonacci. -.n, 2); [parens can be used to group function application]
+ return.sum.
+ (fibonacci. sub.n, 1),
+ (fibonacci. sub.n, 2);
};
fn.main -> { [where our code will begin executing]