enso: Init repo

This commit is contained in:
buckwheat
2025-12-25 19:21:16 -08:00
commit fdba0b01d4
7 changed files with 151 additions and 0 deletions

1
tests/config.nims Normal file
View File

@ -0,0 +1 @@
switch("path", "$projectDir/../src")

34
tests/test.nim Normal file
View File

@ -0,0 +1,34 @@
import enso
import std/strformat
proc unsafe_void(str: string) =
echo str
proc unsafe_int(str: string): int =
echo str
result = 1
func add_two(x: int): int = x + 2
func main() =
run strput("Hello from Enso!")
let
out_void: IO[void] = lift do(): unsafe_void("void")
out_int: IO[int] = lift proc(): int = unsafe_int("int")
out_void()
run strput(fmt"{out_int()}")
let
num_list: IO[seq[int]] = to_IO @[1, 2, 3, 4, 5]
list_added: IO[seq[int]] = num_list.map(add_two)
run strput(fmt"{list_added()}")
run strput("Enter a string")
let read: IO[string] = readstr(STDIN)
run strput(read())
when isMainModule:
main()