Tag | F# Posts

It was another engaging presentation at this month’s CITAG meeting as Joe Hummel presented functional programming and its implementation using F#. Some times it is fun to attack a mind bending problem and this was one of those times. Leaning about functional programming caused about the same brain cramps as moving from procedural to object oriented for the first time. Of course when you start to get it the effect is almost euphoric. I would suggest that if you haven’t looked into functional programming ...
I parse/scrape a few web page every now and then and recently ran across an error that stated: "The server committed a protocol violation. Section=ResponseStatusLine". Cause?: On this page, I found an answer that suggests simply that the server header does not conform to the HTTP v1.1 specification. [Paraphrased...] This issue is caused when a response followed by a request to {certain} services violate the HTTP v1.1 specification. As an example, HTTP header keys should specifically not include any ...
Technorati Tags: Linq,Enumerable.Range,Inter... Basic,VB MSDN Reference: Enumerable.Range Method I deal with a lot of RANGES at work for a multitude of reasons. When auditing data and databases, it’s often necessary to check the boundaries of values or to set them. I’ve recently become very fond of Enumerable.Range because it offers a lot of convenience when dealing with certain types of ranges and can allow a fair amount of complexity. For instance: If I need to represent ...
While I was building the position heuristic function for Connect Four I ran into an interesting gotcha with F# pattern matching. Lets see if you see it before I tell you what it is: let rec heuristic (positions: (int * int) list) (pos: int*int) = match positions with | [] -> 0 | position::_ -> 1 + (heuristic (List.tl positions) pos) | _ -> heuristic (List.tl positions) pos Looking at it, it seems the code should tell me how often value is in position, right? Well it doesn’t! And there is ...
I ran into some rather interesting numbers while trying to optimize my Connect Four implementation. Try to guess what this code will print out: let test= let stop1 = Stopwatch.StartNew() let list = [1..1000000] let bla = list |> List.fold (fun state x -> state + x) 0 stop1.Stop() let stop2 = Stopwatch.StartNew() let seq = seq{1..1000000} |> Seq.fold (fun state x -> state + x) 0 stop2.Stop() let stop3 = Stopwatch.StartNew() let arr = [|1..1000000|] let arr1 = arr|> Array.fold (fun state ...
Last time we saw how to implement the basic miniMax algorithm, this time we will continue by designing game board representation. Basically I want to start out with the “simplest thing that might possibly work” and optimize from there. The simplest thing to use for this in F# is a 2 dimensional list. The problem is that we get some really bad performance for random access into them, because unlike C# Lists, called ResizeArray in F#, they really are represented by lists internally. To be precise they ...
Lately there has been a lot of buzz about functional programming, mostly because it is supposed to be the cure to all of our concurrency troubles. The answer to this from MS has been to productize F#, a functional, object oriented language, running on .Net . There have been a lot of great blog posts and articles about F# in the internet, so if you are looking for a basic introduction this is not really the place. This series is supposed to fill in the whole i saw while searching for F# content. It ...
Coding would be the right answer I guess, but more about that later. I will be starting out this blog with a totally useless post just to try out the GWB blogging software, so if you are reading this spare yourself the pain... Other then that I will soon start with a series on F# programming and hope to continue bringing in some .Net content. Cheers to you all and please don't flame a new blogger to much;) Technorati Tags: .Net,F#,FSharp ...
I was thinking today and had a crazy idea about a virtual / completely online coding dojo. So follow me here for my “virtual tour” of what I’m thinking: Friday rolls around, and you’re excited. Tonight marks the release of the latest project in the Virtual F# Dojo. You check the VF#D blog and find out the latest project is KataBowling. A simple enough program to write, and you’ve been looking for a reason to explore the power of F#, so you dive in. Once you’ve got your example working, you check ...