-
Notifications
You must be signed in to change notification settings - Fork 0
/
something.ohuaml
32 lines (22 loc) · 966 Bytes
/
something.ohuaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
(* comments are enclosed thusly *)
(* each module has a name *)
module some_ns
(* imports are either algos or stateful functions. Using `import` brings the
*module* into scope. Individual items may be included in the refer list
following it, which means they may be used unqualified. *)
import sf ohua.math (mult, isZero)
import algo some.module (a);; (* the `;;` is optional here *)
(* top level bindings are defined with `let` and terminate with `;;` *)
let square = \x -> mult x x;;
(* top level bindings can use the function syntactic sugar of `name [patterns] =
body` for `name = \pat0 -> \pat1 -> ... -> body` *)
let algo1 someParam =
(* lets are of the form `let pattern = expression in expression` *)
let a = square someParam in
let coll0 = ohua.lang/smap (\i -> square i) coll in
(* if-then-else expressions are supported as one would expect *)
if isZero a
then coll0
else a;;
let main param param2 =
algo0 param;;