foldl (\\${x} ${element} -> ${x} + ${element}) ${acc} ${collection}
      Haskell language logo

      foldl

      0

      0

      avatar
      lucycodes42
      Haskell public recipes

      This code calculates the sum of the elements in the collection, and then folds the result into the accumulator. The foldl function takes a function that takes two inputs: the current element and a default value. The function is called with the current element and the default value, and the result is returned to the foldl function. The Foldl function then uses the + operator to add the default value to the current element, and returns the result.

      Shortcut: foldl

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.