Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
21
Task/Menu/Langur/menu.langur
Normal file
21
Task/Menu/Langur/menu.langur
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
val .select = f(.entries) {
|
||||
if not isArray(.entries): throw "invalid args"
|
||||
if len(.entries) == 0: return ""
|
||||
|
||||
# print the menu
|
||||
writeln join "\n", map(f $"\.i:2;: \.e;", .entries, 1..len .entries)
|
||||
|
||||
val .idx = toNumber read(
|
||||
"Select entry #: ",
|
||||
f(.x) {
|
||||
if not matching(RE/^[0-9]+$/, .x): return false
|
||||
val .y = toNumber .x
|
||||
.y > 0 and .y <= len(.entries)
|
||||
},
|
||||
"invalid selection\n", -1,
|
||||
)
|
||||
|
||||
.entries[.idx]
|
||||
}
|
||||
|
||||
writeln .select(["fee fie", "eat pi", "huff and puff", "tick tock"])
|
||||
Loading…
Add table
Add a link
Reference in a new issue