zip()zip()

zip 函数接受任意数量的 dynamic 数组,并返回一个数组,其元素都是一个数组,后者包含同一索引的输入数组的元素。The zip function accepts any number of dynamic arrays, and returns an array whose elements are each an array holding the elements of the input arrays of the same index.

语法Syntax

zip(array1, array2, ... )zip(array1, array2, ... )

参数Arguments

2 到 16 个动态数组。Between 2 and 16 dynamic arrays.

示例Examples

以下示例返回 [[1,2],[3,4],[5,6]]The following example returns [[1,2],[3,4],[5,6]]:

print zip(dynamic([1,3,5]), dynamic([2,4,6]))

以下示例返回 [["A",{}], [1,"B"], [1.5, null]]The following example returns [["A",{}], [1,"B"], [1.5, null]]:

print zip(dynamic(["A", 1, 1.5]), dynamic([{}, "B"]))

以下示例返回 [[1,"one"],[2,"two"],[3,"three"]]The following example returns [[1,"one"],[2,"two"],[3,"three"]]:

datatable(a:int, b:string) [1,"one",2,"two",3,"three"]
| summarize a = make_list(a), b = make_list(b)
| project zip(a, b)