October commit
- custom parser support and infra - type-tagging and traits (untested) - match expressions
This commit is contained in:
@@ -5,7 +5,7 @@ const folder_view := (path, next) => do{
|
||||
cps println $ "Contents of " ++ fs::os_print path;
|
||||
cps entries = async::block_on $ fs::read_dir path;
|
||||
cps list::enumerate entries
|
||||
|> list::map (pass \id. pass \name. \is_dir.
|
||||
|> list::map ((t[id, t[name, is_dir]]) =>
|
||||
println $ to_string id ++ ": " ++ fs::os_print name ++ if is_dir then "/" else ""
|
||||
)
|
||||
|> list::chain;
|
||||
@@ -17,7 +17,7 @@ const folder_view := (path, next) => do{
|
||||
|> tuple::pick 0 2;
|
||||
next parent_path
|
||||
} else do {
|
||||
cps subname, is_dir = to_uint choice
|
||||
let t[subname, is_dir] = to_uint choice
|
||||
|> (list::get entries)
|
||||
|> option::unwrap;
|
||||
let subpath = fs::join_paths path subname;
|
||||
|
||||
21
examples/match/main.orc
Normal file
21
examples/match/main.orc
Normal file
@@ -0,0 +1,21 @@
|
||||
import std::to_string
|
||||
|
||||
const foo := t[option::some "world!", option::none]
|
||||
|
||||
const test1 := match foo {
|
||||
t[option::some balh, option::none] => balh;
|
||||
}
|
||||
|
||||
const bar := map::new[
|
||||
"age" = 22,
|
||||
"name" = "lbfalvy",
|
||||
"is_alive" = true,
|
||||
"species" = "human",
|
||||
"greeting" = "Hello"
|
||||
]
|
||||
|
||||
const test2 := match bar {
|
||||
map::having ["is_alive" = true, "greeting" = foo] => foo
|
||||
}
|
||||
|
||||
const main := test2 ++ ", " ++ test1
|
||||
Reference in New Issue
Block a user