Tag Archives: Development

A simple BigNum library for .NET

Update
Due to minor demand, the code is also available: BigNum source.
Please note that I haven’t actually touched the code since it was first written. I’m sure there’s some things that don’t work properly. If you’re doing anything big with this you probably want to write some ‘destructive’ update functions for adding, etc. At the moment [...]

Fun(c) with C# 3.0

Looking through the list of predefined (or, in Microsoft’s parlance, standard) query operators defined in C# 3.0, there is one that stands out as missing: the ‘map’ function. However, with the new query expression syntax, this is trivial to define:

public static IEnumerable<T> Map<F,T>(Func<F,T> func, IEnumerable<F> source)
{
return
[...]

Lazy Lists in C#

I had the thought—while browsing through some old code—that the code I used to implement futures in C# would be useful for doing things lazily, if you just moved the evaluation phase to when the value was actually demanded… this started me off thinking about how to implement a proper lazily-evaluated list in C#.
A first [...]

NullPointerException

Why is this such an insidious error in Java? (An opinion piece!)
A Comparison
Firstly, I’ll show a short comparison between some Java code and some code from a language that doesn’t have NullPointerExceptions, but does have something that allows you to accomplish anything you might want to do with null pointers.
This Java code:
AnObject thing = someMethod();
is [...]