asynchronous - F#: Equivalent to OCaml Async -


Is F # equivalent to the Ascink library of Okam? In particular, the ability to easily create deferred values ​​and perform functions when they are full?

Specifically, I want to wait in a specific context, and then do something. In the Okam, I can do this by making an ivar and calling my reading function; How can I do this in F #?

short answer

Yes, my Library Jane Street's non-essential library and many others Among people there are close relatives of both of F #. Based on HOPAC (CML) and arguably (according to the technical terms compared to the point of view) currently offers a more expressive programming model than the two.

Long answer

Jane Street is very much like a net. Both are essentially abstract with a monadic layer written on top.

In Hopac, one of the closest relatives of Defredding is actually one. However, HOPKAC does not provide a monadic layer directly for the promise. Of course, you can easily write one, but I will advise him to sit on it for a while. Instead, the hoppac provides the mood for encoding the light-weight threads. It is similar and more natural and feels in my subjective opinion.

Jane Street is unconcerned, both of Hopac's closest relatives descend from the same lineage.

CML and HOPKAC make as more expressive from asynchronous workflows of asynchronous and F # of Jane Street, availability of connectors for synchronous events (CML) or (Hopack). Using those many types of concurrent protocols can be explained in the first class, extensible, selective operation.

Synchronous support of CML and Hopac General dedication means both ends of communication agree when communication occurs. In return, there are some interesting applications such as the ability to implement garbage collected publication-subscription style communication without the need to explicitly cancel the subscription.

Specific Answer

This is an F # interactive session, which first defines an Ivor and then starts a concurrent job that reads the value of the virus and the message Prints Finally, IVar is written with a value:

  & gt; Name by name: IVar & lt; String & gt; = Ivar () ;; Val nominated: IVar & lt; String & gt; & Gt; Start (nameVar |>> Fun Joe -> Printfn "Hello,% s!" Joe) ;; This value is: unit = ()> Play (Namwar and lieutenant; - = "Vesa") ;; This value is: unit = ()> Hello, Vesa!   

To create this output, Flickr was started with #interactive scripts.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -