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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:32:24+00:00 2026-05-25T02:32:24+00:00

here is my code : let go thriller = work.ListPos.Clear() thriller work.Thread.Start() member X.Start()

  • 0

here is my code :

let go thriller =
    work.ListPos.Clear()
    thriller
    work.Thread.Start()

member X.Start() =
    work.ListPos.Add <| new Packet( connector.Authorize("admin","1") ) |> go

So it doesn’t work. I used wrapper with parameter like this :

let inconnection thriller   = 
    using <| new SqlConnection(insql)  <| fun X -> X.Open(); thriller X;

inconnection <| fun X ->

I can’t use it this way without parameters because I got no X (parameter) but how to create lambda without parameters ?

Thank you.

  • 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-25T02:32:24+00:00Added an answer on May 25, 2026 at 2:32 am

    As far as I can see, you’re trying to implement the “hole in the middle” pattern – that is, run some initialization, then run a function specified by the user and then run some cleanup.

    As dahlbyk already pointed out, you need to pass your go operation a function of type unit -> unit. This can be written like this:

    let go thriller =
        work.ListPos.Clear()
        thriller()
        work.Thread.Start()
    
    // Use it like this:
    go (fun () ->
      work.ListPos.Add(new Packet( connector.Authorize("admin","1"))
    )
    

    Aside. Your other example isn’t really idiomatic F# code. The using function can be replaced with a use keyword, which is significantly easier to use:

    let inconnection thriller   = 
        use conn = new SqlConnection(insql) 
        conn.Open()
        thriller conn
    
    inconnection (fun conn -> ...)
    

    More tricky option.
    Alternatively, you can also use the use keyword for other things than disposing of resources like SQL connections. This could make your go function even nicer (but it depends on your particular case). The idea is that you’ll be able to write:

    use u = go()  // work.ListPos.Clear() gets called here
    work.ListPos.Add(new Packet(connector.Authorize("Admin", "1")))
    // work.Thread.Start() gets called automatically when 'u' variable goes out of scope
    

    To do this, you need to define go as a function that returns IDisposable that performs the cleanup:

    let go () =
      work.ListPos.Clear()
      { new IDisposable with
          member x.Dispose() = work.Thread.Start() }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my code: let avg l = List.fold_left ( +. ) 0. l
Let me first put the code snippets here. I am just using the ASP.NET
I use GetOpenFilename() to let the user select a file. Here is the code:
Here is code from MSDN . I don't understand why the work isn't just
Here's code that works fine: let f x y z = x + y
Here is my code: open System let rec gcd a b = match b
i found a code here, to let the mouse on the click and scroll
I'm having a problem with this code here. using (MemoryStream ms = new MemoryStream())
Ok the error is showing up somewhere in this here code if($error==false) { $query
Here a code to demonstrate an annoying problem: class A { public: A(): m_b(1),

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.