Lukas Domagala

  Home  |   Contact  |   Syndication    |   Login
  6 Posts | 0 Stories | 8 Comments | 0 Trackbacks

News

I have joined Anti-IF Campaign
Subscribe in a reader

Tag Cloud


Archives

Post Categories

Active Patterns

There are 1 entries for the tag 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...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati