Yan Cui's blog articles

0
comment
on 1/9/2012 5:43 PM
In C#, you can use the object/collection initialization syntax like this: The F# equivalent of object initialization is done like this: As for collection initialization, you have a far more diverse range of tools available to you, for example: You can also create slices of an existing array: You can even add your own multi-dimensional [...]
>> Read the full article
.
0
comment
on 1/8/2012 9:29 AM
If you’re reading this post, you probably know about F#’s Units of Measure already, it’s very useful when working with real-world units and adds extra safety to code that needs to work with and convert from one unit to another. Here’s a quick snippet that shows you how to define and use units-of-measure: This code [...]
>> Read the full article
.
0
comment
on 1/1/2012 1:36 PM
After reading this old post by Don Syme, I really liked the idea of wrapping the result of any computation into an option type to signify success and failure cases and stop subsequent computations on the first failure. It’s neat but I wanted to tweak a couple of things to make it more useful: exceptional [...]
>> Read the full article
.
0
comment
on 12/29/2011 4:41 PM
In C#, you define an empty class, struct, or interface like this: So how do you define an empty type in F#? Well, whenever you define a new class in F#, the compiler infers the class and end tokens at the beginning and end of the class’s definition, as you can see from below: So [...]
>> Read the full article
.
0
comment
on 12/25/2011 5:24 PM
There’re a number of built-in literal types in F#, and one of the cool things you can do is to get the byte or byte array representation of a char or string using the ‘B’ suffix, the result is the same as Encoding.ASCII.GetBytes: Pretty cool, eh?
>> Read the full article
.
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper