So we know how to use a type parameter to statically constrain the length of a list. Let’s continue our exploration of type constraints and see if we can figure out how to constrain the return type of a data constructor.
|
||||||
|
So we know how to use a type parameter to statically constrain the length of a list. Let’s continue our exploration of type constraints and see if we can figure out how to constrain the return type of a data constructor.
The pattern matching syntax of F# will change the way you write code. Of all the reasons to begin the move from VB to F#, the declarative style of pattern matching is reason number one. The days of the “nested if” are numbered and blood pressures [...] To generate a list of Fibonacci numbers, we created a generator class that emulates the behavior of the c# yield statement. We’ll expand on this generator in another blog to enable us to write LINQ methods, but for right now we’ll use if for a similar task, generate a list or primes.
When working through the project euler problems in visual basic we very quickly run into a limitation of the language, visual basic does not support iterators. Unfortunately, iterators probably won’t make it into the next version of vb either. So time to get our hands dirty and roll our own iterator support.
I’ve been looking for some little programs to work on in order to learn F#. Thankfully, I stumbled across Dustin Campbell’s blog, which led me to following site. http://projecteuler.net It’s really a lot of fun and a great way to learn F#. Dustin has been showing the solutions in F# and [...] Last time we discovered 3 things about writing a map function in Visual Basic. · The code is way longer.
A great way to learn something new is to map it to something that is already familiar. Often times mapping the new concept to what you already know forces you to reexamine the way you are doing something. In part 1 we built ourselves a handy recursive map function using F#. [...] |
||||||
|
Copyright © 2010 Do Loop Until You Die - All Rights Reserved |
||||||