Archive for October, 2009

Ruby Cons 0

I think technically this counts as an application of my readings from Algebra of Programming. Satisfied.

class Cons
  include Enumerable
  attr_accessor :child, :value

  def self.[](value, child=:empty)
    new(value, child)
  end

  def initialize(value, child)
    @value, @child = value, child
  end

  def each
    x = self
    while( x != :empty)
      yield x
      x = x.child
    end
  end
end

x = Cons['MWA', Cons['HAHA', Cons['HAHA']]]
puts x.inject(''){ |acc, x| acc+=x.value  }

As a side note, I hope that someone finds this page looking for a list of negative things about ruby. Maybe if you run the code you’ll find something >:]

Stolen gem name? 0

[Update: Nick Quaranto was kind enough to respond to my twitter message, and the issue has been resolved. Many thanks Nick!]

So I went to publish RQuery to gem cutter but I got this lovely tidbit:

Pushing gem to Gemcutter...
You do not have permission to push to this gem.

I figured someone had clearly come up with a similar name and applied it to their gem so I went and searched and found:

http://gemcutter.org/gems/rquery

Needless to say I was a little bit bummed, but I thought it odd that its was just a dot one version higher than my last release, and then I noticed that the homepage link points back to none other than my page about the darn gem!

What that hell man, gimme my gem name back!