Data update
This commit is contained in:
parent
29a5eea0d4
commit
5c1bb7bfa9
2011 changed files with 35081 additions and 3229 deletions
|
|
@ -1,21 +1,21 @@
|
|||
val .select = impure fn(.entries) {
|
||||
if .entries is not list: throw "invalid args"
|
||||
if len(.entries) == 0: return ""
|
||||
val choose = impure fn(entries) {
|
||||
if entries is not list: throw "invalid args"
|
||||
if not entries: return ""
|
||||
|
||||
# print the menu
|
||||
writeln join "\n", map(fn(.e, .i) $"\.i:2;: \.e;", .entries, 1..len .entries)
|
||||
writeln join("\n", map(fn e, i: "{{i:2}}: {{e}}", entries, 1..len(entries)))
|
||||
|
||||
val .idx = number read(
|
||||
val idx = read(
|
||||
"Select entry #: ",
|
||||
fn(.x) {
|
||||
if not .x -> RE/^[0-9]+$/: return false
|
||||
val .y = number .x
|
||||
.y > 0 and .y <= len(.entries)
|
||||
fn(x) {
|
||||
if not x -> RE/^[0-9]+$/: return false
|
||||
val y = x -> number
|
||||
y > 0 and y <= len(entries)
|
||||
},
|
||||
"invalid selection\n", -1,
|
||||
)
|
||||
) -> number
|
||||
|
||||
.entries[.idx]
|
||||
entries[idx]
|
||||
}
|
||||
|
||||
writeln .select(["fee fie", "eat pi", "huff and puff", "tick tock"])
|
||||
writeln choose(["fee fie", "eat pi", "huff and puff", "tick tock"])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue