Dot Net What Not Posts

Inspired by an amazingly concise implementation of John Conway’s game of Life that I saw written in APL, I decided to see if I could write Life in a single Linq expression.

This (rather long and rambling) post documents my attempts, my eventual success and the result that it made me want to learn APL!

I’ve been trying to write functional code for some time now, and still have the feeling that I’m not doing it correctly, especially when seemingly simple things don’t work. Having bumped into one specific issue over and over again, I decided to try and sort it out once and for all. Imagine a stupidly simple API endpoint that take a float, and returns the square root doubled. I have helper functions as follows… My API endpoint returns a string of the form “Result: 23.3” if successful, or an error if not. I wire these together as follows… This works as expected. Obviously, my real code would have more from clauses than this, but I’m trying to keep this simple. Now, suppose (which is more realistic) the helper functions were async, then I would need to modify my endpoint to look like this… Again, all works. However, now in the case…

As a (somewhat lapsed but still interested) mathematician, I like to play around with interesting numbers. Well, I guess we all have our little foibles eh?

I decided to have a go at generating pairs of amicable numbers using Linq. This post explains what they are, and how I went about it.

One of the nice things about a modern IDE like Visual Studio is the help you get when coding. XML documentation, which shows up as a pop-up below the line of code you’re writing helps you check you’re using the right method.

Sometimes it tells you a little bit more than that…