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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:55:01+00:00 2026-06-06T15:55:01+00:00

Using the Programming F# book, there’s an example first given as serial: let result1

  • 0

Using the Programming F# book, there’s an example first given as serial:

let result1 = longTask1()
let result2= = LongTask2()

Then using the PFX it is given to be

Open System.Threading.Tasks

let taskBody = new Func<string>(longTask1)
let task = Task.Factory.StartNew<string>(taskBody)

let result2 = longTask2()
let result1 = task.Result

However, in my case the function readBlock takes in a string filePath as argument and returns a seq. I tried like this

let taskBody = new System.Func<string, seq<_>>(readBlock)
let task = Task.Factory.StartNew<seq<_>>(taskBody.Invoke(filePath))

This is showing an error for the Task.Factory.StartNew portion – too many arguments. So how to go about calling parameterized functions that return a value?

  • 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-06T15:55:04+00:00Added an answer on June 6, 2026 at 3:55 pm

    The code in the book is quite obsolete. The book was written before the release of VS 2010, some parts of F# and PFX weren’t settled yet.

    Now you can write:

    let task = Task.Factory.StartNew(fun () -> readBlock(filePath))
    

    The type checker will infer an appropriate type for task, and you can invoke task.Result to get results later on.

    There is implicit conversion between closure and System.Func<_, _>, and using closure is more readable in this case.

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

Sidebar

Related Questions

I'm using Schaum's Outline of Programming With Fortran 77 book, and there's an example
I'm currently learning about pointers in my C++ book (Programming: Principles and Practice using
I'm reading Beginning Java Game Programming 2/e and the book heavily emphasizes using AffineTransform.
I'm doing the exercises in Stroustrup's new book Programming Principles and Practice Using C++
I'm using xCode 4.2, and going through the book Programming in Objective C 2.0
I'm currently learning Windows programming through the Win32 API using Petzold's book as a
I was reading 'C++ Template complete guide' book, part about meta programming. There is
I'm programming using GWT, which includes Jetty. I have defined my own servlet and
i'm using ECLiPSe programming logic system. i want to implement the yield method for
I'm using GNAT Programming Studio to update some ada files. I have a style

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.