September-october commit

- manual parser
- stl refinements
- all language constructs are now Send
This commit is contained in:
2023-10-11 18:27:50 +01:00
parent 56679dcc01
commit 86e520e8b8
127 changed files with 1666 additions and 1872 deletions

View File

@@ -1,4 +1,4 @@
import std::(proc::*, to_float, to_string, panic, str::char_at)
import std::(to_float, to_string, panic, string::char_at)
export const main := do{
cps print "left operand: ";
@@ -6,7 +6,6 @@ export const main := do{
let a = to_float data;
cps print "operator: ";
cps op = readln;
let op = char_at op 0;
cps println ("you selected \"" ++ op ++ "\"");
cps print "right operand: ";
cps data = readln;

View File

@@ -1,18 +1,17 @@
import system::(io, directfs, async)
import std::proc::*
import std::(to_string, to_uint, inspect)
const folder_view := \path.\next. do{
const folder_view := \path. \next. do{
cps println $ "Contents of " ++ directfs::os_print path;
cps entries = async::block_on $ directfs::read_dir path;
cps list::enumerate entries
|> list::map (pass \id. pass \name.\is_dir.
|> list::map (pass \id. pass \name. \is_dir.
println $ to_string id ++ ": " ++ directfs::os_print name ++ if is_dir then "/" else ""
)
|> list::chain;
cps print "select an entry, or .. to move up: ";
cps choice = readln;
if (choice == "..\n") then do {
if (choice == "..") then do {
let parent_path = directfs::pop_path path
|> option::unwrap
|> tuple::pick 0 2;

View File

@@ -1,5 +1,7 @@
import std::exit_status
const main := (
println "Hello, world!"
"success"
exit_status::success
)
-- main := "Hello, World!\n"

View File

@@ -1,4 +1,4 @@
import std::(proc::*, to_string)
import std::to_string
export const main := do{
let foo = list::new[1, 2, 3, 4, 5, 6];
@@ -6,7 +6,7 @@ export const main := do{
let sum = bar
|> list::skip 2
|> list::take 3
|> list::reduce (\a.\b. a + b)
|> list::reduce (\a. \b. a + b)
|> option::unwrap;
cps println $ to_string sum;
0

View File

@@ -1,4 +1,4 @@
import std::(proc::*, to_string)
import std::to_string
export const main := do{
let foo = map::new[