locked
Should we avoid recursion? RRS feed

  • Question

  • I have a function that takes two parameters: a piece of text, and a table containing two text columns. The function takes the text then loops over each row in the table and replaces each word in the first column with the word in the second column. My question is this though: I have two versions of the function, one that us written as a recursive function and one that uses List.Generate(). Which one is likely to be better? Is recursion something we should try to avoid?

    Chris


    Check out my MS BI blog I also do SSAS, PowerPivot, MDX and DAX consultancy and run public SQL Server and BI training courses in the UK

    Thursday, June 19, 2014 7:55 PM

Answers

  • List.Generate is preferable to recursion because Power Query doesn't currently do tail call elimination (nor are there any plans to implement it).
    Friday, June 20, 2014 3:31 AM

All replies