In F# what does the >> operator mean?

It’s the function composition operator. More info on Chris Smith’s blogpost. Introducing the Function Composition operator (>>): let inline (>>) f g x = g(f x) Which reads as: given two functions, f and g, and a value, x, compute the result of f of x and pass that result to g. The interesting thing … Read more

.NET Core 3 preview 4: ‘AddNewtonsoftJson’ is not defined

In order to switch ASP.NET Core 3.0 back to use JSON.NET, you will need to reference the Microsoft.AspNetCore.Mvc.NewtonsoftJson NuGet package. That will contain the AddNewtonsoftJson extension method. In C#, this would look like this: services.AddControllers() .AddNewtonsoftJson(); So assuming that I understand enough of F#, I would say that your call would be correct if you … Read more

F#, Split String and .Net methods

You call them as instance methods: let Count (text : string) = let words = text.Split [|’ ‘|] let nWords = words.Length (nWords) (Note you need to use [| |] because Split takes an array not a list; or, as per Joel Mueller’s comment, because Split takes a params array, you can just pass in … Read more

Accessing a specific member in a F# tuple

You want to prevent your wife from aging by making her age immutable? 🙂 For a tuple that contains only two members, you can fst and snd to extract the members of the pair. let wifeName = fst myWife; let wifeAge = snd myWife; For longer tuples, you’ll have to unpack the tuple into other … Read more

F# string.Format

If you want to avoid using the full name, you can use open in F#: open System let s = String.Format(“Hello {0}”, “world”) This should work in both F# interactive (enter the open clause first) and in normal compiled applications. The key thing is that you must write String with upper-case S. This is because … Read more

cons operator (::) in F#

As others said, there is no such operator, because it wouldn’t make much sense. I actually think that this is a good thing, because it makes it easier to realize that the operation will not be efficient. In practice, you shouldn’t need the operator – there is usually a better way to write the same … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)