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 882175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:23:14+00:00 2026-05-15T12:23:14+00:00

Ok this is rather frustrating, I;ve installed the latest version of SharpDevelop, and also

  • 0

Ok this is rather frustrating, I;ve installed the latest version of SharpDevelop, and also installed the F# compiler (as per the link from SharpDevelops website)

I am running in Vista.

thus far, everything has been working fine.

But for some reason it simply refuses to compile when I try to use List.fold_left, however List.fold seems to work,

here is the error:

The value, constructor, namespace or type ‘fold_left’ is not defined (FS0039)

here is the code:

#light
open System
let nums = [1..10]
let ans = List.fold_left (+) 0 nums
Console.WriteLine("answer: {0}", ans)
// Just to make it pause
let pause = Console.ReadLine()

the further issues is I’m trying to use the fold to square each item in the list eg:

1^2 + 2^2 + 3^2 ...

I assumed that the Fold takes a function and a list, so I’ve tried as follows:

let sq x = x*x
let ans = List.fold (sq) 0 nums

but this gives me the following error both on the second line:

The type ‘int -> int’ does not match the type ‘int’ (FS0001) –
The type ”a -> int’ does not match the type ‘int’ (FS0001) –

Please can someone explain this?

  • 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-15T12:23:14+00:00Added an answer on May 15, 2026 at 12:23 pm

    List.fold_left was the old name for the function, which is now List.fold. The problem that you have is that List.fold takes two arguments, the first of which is the function to fold over the list and the second of which is the initial seed for the recursion. The function you use needs to take two arguments, the running total so far and the next element of the list. You want to use something like

    List.fold (fun sum x -> sum + x * x) 0 [1..10]
    

    The error you got was just telling you that the type of the function you were trying to use didn’t take the right number of arguments.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

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.