New answers tagged

1

There isn't much to add to torbondes answer except the following details: // Check each field of the record to see if it makes a set let colorSet = cardList |> List.map (fun c -> c.Color ) |> isSet let shapeSet = cardList |> List.map (fun c -> c.Shape ) |> isSet let patternSet = cardList |> List.map (fun c -> c.Pattern) |> ...


5

Well, you're off to a good start, I think. Only one major thing comes to mind, when I read your code. Tuples Instead of operating on seqs or similar, use a tuple. The size of a tuple is fixed and known at compile time. In this game, you know you'll always consider three cards at a time, so it fits the bill. This will also help simplify your allEqual and ...


1

In general in F# we try to minimize the use of explicit type declaration on function arguments: let left (node: Node<'a>) = node.Left becomes let left node = node.Left etc. The function insertNode violates the single responsibility principle in that if root = None then it creates a new tree/root node instead of actual inserting the value. ...


Top 50 recent answers are included