跳到正文
本页尚未翻译成中文,以下为英文原文。 查看英文版

coalescelist Function ​

coalescelist takes any number of list arguments and returns the first one that isn't empty.

Examples ​

shellsession
> coalescelist(["a", "b"], ["c", "d"])
[
  "a",
  "b",
]
> coalescelist([], ["c", "d"])
[
  "c",
  "d",
]

To perform the coalescelist operation with a list of lists, use the ... symbol to expand the outer list as arguments:

shellsession
> coalescelist([[], ["c", "d"]]...)
[
  "c",
  "d",
]
  • coalesce performs a similar operation with string arguments rather than list arguments.

基于 MPL-2.0 许可证发布。