Here is my solution to adventcode problem 7 using F#.

I am using the adventofcode to improve my functional programming skills. The gist of the problem is to solve the logic gates which is represented as 16 bit integer’s and these depend on other gates.

The puzzle starts of with simple problem

`123 -> x`

`456 -> y`

`x AND y -> d`

`x OR y -> e`

`x LSHIFT 2 -> f`

`y RSHIFT 2 ->`

`g NOT x -> h`

`NOT y -> i`

where the if you solve the above the code should work. But the complexity comes in when the order of the gates are not as expected and so the code would have solve the dependent ones before solving the entire solution.

One of the things that I really love about the FP code is union types and pattern matching.

That is the composite type that could hold multiple different data types. In a non-functional static language I would have ended up creating nested types for each one of these.

My solutions to the adventofcode is here https://github.com/naveensrinivasan/adventcode/

After finishing I realized that I could have used the Tree structure which could help in traversal of the tree.

Here is my solution.