比如 列表1:{{"a","b","c"},{"d","e","f"},{"h","i","j"}}
列表2:{"w","x","y"}
想把列表2中的元素对应加到列表1中,想得到的结果 :{{"a","b","c","w"},{"d","e","f","x"},{"h","i","j","y"}},请问这个如何实现,试了下List.Combine 但是不对,求帮助!!
比如 列表1:{{"a","b","c"},{"d","e","f"},{"h","i","j"}}
列表2:{"w","x","y"}
想把列表2中的元素对应加到列表1中,想得到的结果 :{{"a","b","c","w"},{"d","e","f","x"},{"h","i","j","y"}},请问这个如何实现,试了下List.Combine 但是不对,求帮助!!
fyi...结果1,结果2都可以。结果1容易点,zip一下,一一对应。
= let a = {{"a","b","c"},{"d","e","f"},{"h","i","j"}},
b = {"w","x","y"},
结果1 = List.Transform(List.Zip({a,b}),each _{0}&{_{1}}),
结果2 = List.Accumulate( {0..2},
a,
(s,c)=>List.ReplaceRange(s,c,1,{s{c}&{b{c}}}))
in
结果1
上上下左右左右BABA。
let
a= {{"a","b","c"},{"d","e","f"},{"h","i","j"}},
b = {"w","x","y"},
c1=List.Transform( List.Zip({a, List.Transform(b,each {_}) }),each List.Combine(_)),
c2=List.Transform({0..List.Count(a)-1},each a{_}&{b{_}})
in
c2
感谢大家的参考和思路!!