Geeks With Blogs

News I have joined Anti-IF Campaign
Subscribe in a reader
Lukas Domagala Pattern Matching There are 1 entries for the tag Pattern Matching
FSharp Pattern Matching gotcha and Active Patterns
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 ......

Posted On Thursday, June 25, 2009 10:18 PM

Copyright © Domagala | Powered by: GeeksWithBlogs.net | Join free