mirror of
https://github.com/azur1s/bobbylisp.git
synced 2024-10-16 02:37:40 -05:00
Compare commits
2 commits
8cfeb61549
...
47fbb70b8d
Author | SHA1 | Date | |
---|---|---|---|
Natapat Samutpong | 47fbb70b8d | ||
Natapat Samutpong | dfe6efd326 |
|
@ -2,7 +2,7 @@
|
|||
Programming language that compiles to Typescript!
|
||||
|
||||
```sml
|
||||
fun main : void = do
|
||||
fun main : void = do
|
||||
@write("Hello, World!")
|
||||
end
|
||||
```
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
fun iter_ (vec: [int]) (fn: |int| -> int) (current: int): void = do
|
||||
fun map_ (vec: [int]) (fn: |int| -> int) (current: int): void = do
|
||||
if current == @len(vec) then
|
||||
do end
|
||||
else
|
||||
|
@ -8,16 +8,16 @@ fun iter_ (vec: [int]) (fn: |int| -> int) (current: int): void = do
|
|||
|> @write(_)
|
||||
@write("\n")
|
||||
|
||||
iter_(vec, fn, current + 1)
|
||||
map_(vec, fn, current + 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
fun iter (vec: [int]) (fn: |int| -> int): void = iter_(vec, fn, 0)
|
||||
fun map (vec: [int]) (fn: |int| -> int): void = map_(vec, fn, 0)
|
||||
|
||||
fun mul10 (x: int): int = x * 10
|
||||
|
||||
fun main: void = do
|
||||
let foo: [int] = [69, 420, 727, 1337, 42069, 69420]
|
||||
iter(foo, mul10)
|
||||
map(foo, mul10)
|
||||
end
|
Loading…
Reference in a new issue