// Sample Veko program demonstrating pipes, refinements, structs, and blocks
// Inspect frontend stages: veko inspect --tokens examples/tour.vk ; veko inspect --ast examples/tour.vk ; veko inspect --modules examples/tour.vk
use [h = net/http, j = json, s = strings]
def fetch-fast = h/fetch/timeout
Node = struct {
url str
port int = 443
active bool = true
}
sync-nodes = fn [path] [
urls = fetch-fast 'https://example.com/nodes' 5s
\ j/decode
\ filter fn [n] [n.active]
\ map fn [n] [n.url]
os/write-file path (s/join urls '\n')
urls.len
]