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

  • SEARCH
  • Home
  • 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 6537757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:39:18+00:00 2026-05-25T10:39:18+00:00

I wonder if there is some function in the F# libraries similar to this

  • 0

I wonder if there is some function in the F# libraries similar to this one?

let map_acc (f:int->int) (list:int list) =
  let rec map_acc' f acc = function
    | []   -> []
    | h::t -> (f (h+acc))::(map_acc' f (h+acc) t)
  map_acc' f 0 list

Usage:

let xxx = map_acc id [1..10]

val xxx : int list = [1; 3; 6; 10; 15; 21; 28; 36; 45; 55]

Its purpose is quite similar to map‘s but it passes the current state (in the given case, an accumulator) to each element of the list.

  • 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-05-25T10:39:19+00:00Added an answer on May 25, 2026 at 10:39 am

    Yes, List.scan is the missing key you seek:

    [1..10]
    |> List.scan (+) 0
    |> List.tail //skip the seed value, 0
    |> List.map id //of course, map id is not useful, but just illustration here
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wonder if there's some way of doing this, or even if it should
So far this is my solution. I wonder if there is some more elegant/efficient
hi i wonder if there are some GUI softwares to administrate a svn repo?
hi i wonder if there are some GUI softwares to administrate a svn repo?
I wonder if there's any tool/website where I can plot some run times as
I have started to use Mustache JS some hours ago. I wonder if there
I got some question regarding the shared and static libraries.So let me tell you
I wonder why there doesn't exist a literal for partial function types. I have
Reading this question made me wonder: is there a technical reason for disallowing class
I often deal with objects of this form: v <- list(one = c(a =

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.