foldr

    0

    0

    lucycodes42

    Haskell public recipes

    The foldr function takes two arguments, a function that takes a single argument and a list, and folds each element of the list into the function's argument. The first argument to the foldr function is the function that takes a single argument and the second argument is the list. The foldr function then calculates the sum of each element in the list and adds it to the function's argument. It then returns the result of the function's argument, combined with the collection.

    Shortcut: foldr

    foldr (\\${element} ${x} -> ${x} + ${element}) ${acc} ${collection}
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Explore
    • Cookbooks
    • Playground
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.