Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9137453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:06:19+00:00 2026-06-17T09:06:19+00:00

Could you explain me step by step the result of the second instruction? I

  • 0

Could you explain me step by step the result of the second instruction?

I know how foldr works in this cases:

foldr (*) 1 [-3..-1]
-6

But I don’t know how to deal with the function (\y z -> y*3 + z) in a foldr expression.

foldr (\y z -> y*3 + z) 0 [1..4]
30
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:06:19+00:00Added an answer on June 17, 2026 at 9:06 am

    Let’s look at the definition of foldr:

    foldr f z []     = z 
    foldr f z (x:xs) = f x (foldr f z xs) 
    

    Now, in your example,

    f y z = y*3 + z
    

    So, just using the definitions:

    foldr f 0 [1..4] = 
    f 1 (foldr f 0 [2..4]) =
    f 1 (f 2 (foldr f 0 [3,4])) =
    f 1 (f 2 (f 3 (foldr f 0 [4]))) =
    f 1 (f 2 (f 3 (f 4 (foldr f 0 [])))) =
    f 1 (f 2 (f 3 (f 4 0))) =
    f 1 (f 2 (f 3 12))) = 
    f 1 (f 2 21) =
    f 1 27 =
    30
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is prob pretty easy but if someone could explain the easiest way to
I was wondering if anyone could explain what this rule is saying: <IfModule mod_rewrite.c>
i was just wondering if someone could explain this code for me so i
Could anybody explain step by step why such arguments ( NULL pointer(s) ) when
Could someone please explain (step-by-step) how to connect to some MSSQL DB using application
This behavior is so bizarre that I don't even know how best to ask
I was hoping someone could explain what is happening i the following code taken
I was hoping someone could explain to me how eclipse automatically deploys to your
I was hoping someone could explain why my application when loaded uses varying amounts
I was wondering if someone could explain to me how to make a simple

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.