Skip to content

Commit

Permalink
Fix readme formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
P-bibs committed Sep 6, 2021
1 parent 6a0b62c commit 1981231
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ Next on the road map is an exploration of gradual typing by adding a `typed` key

## What does it look like?

Function definition (types are optional):

```
# function definition (types are optional)
def fact(n: Number) -> Number:
match n:
| 1 => 1
Expand All @@ -33,8 +34,9 @@ def fact(n: Number) -> Number:
end
```

Conditionals:

```
# conditionals
let cond: Boolean = true
if cond:
1
Expand All @@ -45,24 +47,27 @@ else:
end
```

Algebraic datatypes (types are optional):

```
# algebraic datatypes (types are optional)
data Option:
| some(v: Number)
| empty()
end
```

Pattern matching:

```
# pattern matching
match some(1):
| some(n) => n
| empty() => 0
end
```

Anonymous functions:

```
# anonymous functions
let increment: Number -> Number = lambda(n): n + 1 end
let add: (Number, Number) -> Number = lambda(a,b): a + b end
```
Expand Down

0 comments on commit 1981231

Please sign in to comment.