I printed list-b for debug and forgot to remove it. For the descriptions, without testing I think it’s possible as long as you have a list of description (same length), and then iterate over all items in the lists. Something like this essentially.
#let list-a = list-a.map(
x => (
key: x.key,
long: x.long.first(),
description: x.description.slice(1).zip(x.long.slice(1)).fold(x.description.at(0), (desc, d) => {
desc + ". " + d.at(1) + ": " + d.at(0)
})
)
)
Make sure the list-b is updated to match the new structure, then
#let list-a = (
(
key: "Foo",
long: ("Lorem", "Ipsum"),
description: ([Comment A1], [Comment A2])
),
(
key: "Bar",
long: ("Dolor",),
description: ([Comment B],)
),
)
#let list-b = list-a.map(
x => for (i, y) in x.long.enumerate() {((
key: y,
long: x.key,
description: x.description.at(i)
),)}
).flatten()