2018-05-12 18:39:29 +02:00
|
|
|
---
|
2021-11-23 00:57:25 +01:00
|
|
|
layout: "language"
|
|
|
|
page_title: "coalescelist - Functions - Configuration Language"
|
|
|
|
sidebar_current: "docs-funcs-collection-coalescelist"
|
2018-05-12 18:39:29 +02:00
|
|
|
description: |-
|
|
|
|
The coalescelist function takes any number of list arguments and returns the
|
|
|
|
first one that isn't empty.
|
|
|
|
---
|
|
|
|
|
|
|
|
# `coalescelist` Function
|
|
|
|
|
|
|
|
`coalescelist` takes any number of list arguments and returns the first one
|
|
|
|
that isn't empty.
|
|
|
|
|
|
|
|
## Examples
|
|
|
|
|
|
|
|
```
|
2019-04-29 19:11:28 +02:00
|
|
|
> coalescelist(["a", "b"], ["c", "d"])
|
2018-05-12 18:39:29 +02:00
|
|
|
[
|
|
|
|
"a",
|
|
|
|
"b",
|
|
|
|
]
|
2019-04-29 19:11:28 +02:00
|
|
|
> coalescelist([], ["c", "d"])
|
2018-05-12 18:39:29 +02:00
|
|
|
[
|
|
|
|
"c",
|
|
|
|
"d",
|
|
|
|
]
|
|
|
|
```
|
|
|
|
|
2019-04-29 19:11:28 +02:00
|
|
|
To perform the `coalescelist` operation with a list of lists, use the `...`
|
2018-05-12 18:39:29 +02:00
|
|
|
symbol to expand the outer list as arguments:
|
|
|
|
|
|
|
|
```
|
2019-04-29 19:11:28 +02:00
|
|
|
> coalescelist([[], ["c", "d"]]...)
|
2018-05-12 18:39:29 +02:00
|
|
|
[
|
|
|
|
"c",
|
|
|
|
"d",
|
|
|
|
]
|
|
|
|
```
|
|
|
|
|
|
|
|
## Related Functions
|
|
|
|
|
2021-11-23 00:57:25 +01:00
|
|
|
* [`coalesce`](./coalesce.html) performs a similar operation with string
|
2018-05-12 18:39:29 +02:00
|
|
|
arguments rather than list arguments.
|