# some.yaml
people:
- Ingy
- Tina
- Panto
- Eemeli
- Thom
places:
- Seattle
- Berlin
- Athens
- Helsinki
- Buffalo
# generator.ys
!yamlscript/v0
data =: load("some.yaml")
people =: data.people
places =: data.places
defn other(max, person, place)::
string:: "$person likes $place."
number:: int(rand(max)) + 1
take (ARGV.0 || 5):
shuffle:
for [person people, place places]:
merge:
=>::
person:: person
place:: place
# ys --load generator.ys | jq
[
{
"person": "Thom",
"place": "Seattle",
"string": "Thom likes Seattle.",
"number": 4
},
{
"person": "Eemeli",
"place": "Berlin",
"string": "Eemeli likes Berlin.",
"number": 6
}
]