Tags » Xacc.ide

IronScheme update

Hi

Recently I have been converting a lot of procedures from their C# implementation to Scheme. This has proved to be rather successful as the compiler has matured to such a point that it is within 50% of writing the code in C#. 134 more words

Default

System.Double deconstruction extension methods

Recently I discovered an issue with the = procedure in IronScheme, anyways, I was interpreting the semantics incorrectly, and realised I had to deconstruct my floating point representation (System.Double) to get the exact representation of the number, then present it as a rational to check for mathematically correct equality. 249 more words

Default

Tree traversal extension methods

public static class TreeExtensions
{
  public static IEnumerable<R> TraverseDepthFirst<T, R>(
    this T t,
    Func<T, R> valueselect,
    Func<T, IEnumerable<T>> childselect)
  {
    return t.TraverseDepthFirstWithParent(valueselect, childselect).Select(x => x.Key);
  }

  public static IEnumerable<KeyValuePair<R, T>> TraverseDepthFirstWithParent<T, R>(
    this T t,
    Func<T, R> valueselect,
    Func<T, IEnumerable<T>> childselect)
  {
    return t.TraverseDepthFirstWithParent(default(T), valueselect, childselect);
  }

  static IEnumerable<KeyValuePair<R, T>> TraverseDepthFirstWithParent<T, R>(
    this T t,
    T parent,
    Func<T, R> valueselect,
    Func<T, IEnumerable<T>> childselect)
  {
    yield return new KeyValuePair<R, T>(valueselect(t), parent);

    foreach (var i in childselect(t))
    {
      foreach (var item in i.TraverseDepthFirstWithParent(t, valueselect, childselect))
      {
        yield return item;
      }
    }
  }

  public static IEnumerable<R> TraverseBreadthFirst<T, R>(
    this T t,
    Func<T, R> valueselect,
    Func<T, IEnumerable<T>> childselect)
  {
    return t.TraverseBreadthFirstWithParent(valueselect, childselect).Select(x => x.Key);
  }

  public static IEnumerable<KeyValuePair<R, T>> TraverseBreadthFirstWithParent<T, R>(
    this T t,
    Func<T, R> valueselect,
    Func<T, IEnumerable<T>> childselect)
  {
    yield return new KeyValuePair<R, T>(valueselect(t), default(T));

    List<T> children = new List<T>();

    foreach (var e in childselect(t))
    {
      children.Add(e);
      yield return new KeyValuePair<R, T>(valueselect(e), t);
    }

    while (children.Count > 0)
    {
      foreach (var e in new List<T>(children))
      {
        children.Remove(e);
        foreach (var c in childselect(e))
        {
          children.Add(c);
          yield return new KeyValuePair<R, T>(valueselect(c), e);
        }
      }
    }
  }
}

// usage
interface INode<T>
{
  T Value { get; }
  IEnumerable<INode> Children { get; }
}

INode<int> root = ... 17 more words
Default

Right, I need a new job, a decent one.

I am looking for new permanent or contract employment. If you are looking for a very experienced .NET/C# developer (6+ years .NET), please contact me for further details and a copy of my CV. 55 more words

Default

Catastrophic hard disk failure

Exactly a week ago, my 150GB WD Raptor died, it seems like something mechanical or just physical, as Vista reports bad blocks on the drive when inserted via USB (I cant even boot with the drive plugged in). 68 more words

Default

xacc.ide-0.2.0.80 released

0.2.0.80 - July 28, 2007 

- Fixed bug when opening files with "Open with..."/"Open" in Windows Contextmenu
- Fixed loading 'command.ls'
- Fixes to MSIL lexer
Xacc.ide