Created
February 29, 2024 00:52
-
-
Save bjulius/9940423079e266bf40914ccacf77499f to your computer and use it in GitHub Desktop.
List. Accumulate vs List Transform
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let | |
Source = {1..100000}, | |
Accumulate = | |
List.Accumulate( | |
Source, | |
"", | |
( state, current ) => state & ( if state = "" then "" else ", " ) & Text.From( current ) | |
), | |
SplitToList = List.Buffer( Text.Split(Accumulate, """, """)), | |
ConvertToTable = Table.FromList(SplitToList, Splitter.SplitByNothing(), {"Number"}, null, ExtraValues.Error), | |
SplitToRows = Table.ExpandListColumn(Table.TransformColumns(ConvertToTable, {{"Number", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Number") | |
in | |
SplitToRows | |
let | |
Source = {1..100000}, | |
Transform = Text.Combine( List.Transform( Source, each Text.From(_)), ", "), | |
SplitToList = List.Buffer( Text.Split(Transform, """, """)), | |
ConvertToTable = Table.FromList(SplitToList, Splitter.SplitByNothing(), {"Number"}, null, ExtraValues.Error), | |
SplitToRows = Table.ExpandListColumn(Table.TransformColumns(ConvertToTable, {{"Number", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Number") | |
in | |
SplitToRows |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment