coalescelist 함수
coalescelist 함수
coalescelist는 여러 개의 리스트 인자를 받아서 그중 첫 번째로 비어 있지 않은 리스트를 돌려줘요. 여러 후보 중에서 실제 값이 들어 있는 첫 리스트를 골라야 할 때 유용하죠.
출처: Packer 공식 문서
본문
coalescelist takes any number of list arguments and returns the first one that isn't empty.
예시 (Examples)
> coalescelist(["a", "b"], ["c", "d"])
[
"a",
"b",
]
> coalescelist([], ["c", "d"])
[
"c",
"d",
]
리스트의 리스트에서 coalescelist 연산을 수행하려면 ... 기호로 바깥 리스트를 인자로 펼치면 돼요:
> coalescelist([[], ["c", "d"]]...)
[
"c",
"d",
]
관련 함수 (Related Functions)
coalesce는 리스트가 아니라 문자열 인자를 대상으로 비슷한 동작을 해요.