Multiple dispatch in Ruby

I’ve been reading recently about Common Lisp and CLOS and I’ve been intrigued by their radically different approach to OO and some of their interesting features, one of which is multiple dispatch. Most mainstream OO languages don’t support multiple dispatch natively although one can sometimes pull it off with tricks (e.g..: for C++, check out More Effective C++ from Scott Meyers or Alexandrescu’s Modern C++ Design or this article from Dr. Carlo Pescio in C++ Report).

Ruby doesn’t support multiple dispatch natively, but there’s an add-on called the Multiple Dispatch Library (multi) that let’s you do it and it’s a snap to use. Even a Rube n00b like me had it going in 5 minutes…

Continue reading

Accessing C functions from CLISP

It’s pretty impressive how easy it is to call C functions from Lisp, once you know the proper FFI voodoo. For example, this is how I accessed the standard C library function time from CLISP on my Linux system.

(ffi:def-call-out time                                                                                                       
    (:arguments (tloc (ffi:c-ptr-null ffi:int) :in))                                                                           
    (:library "/lib/")                                                                                                
    (:return-type ffi:int))

CL-USER> (time nil)                                                                                                        

Historically, different Lisp implementations have had different FFI syntax though there are things like UFFI and CFFI that are supposed to ameliorate that.

And depending on what Lisp you’re using, you might be able to use SWIG to jumpstart the process.

Books on Lisp from

The Little Schemer - 4th EditionThe Seasoned SchemerPractical Common Lisp

New Series 2 TiVo box with 2 Tuners and Built-In Ethernet

There’s a new TiVo box on the block:

New Series 2 TiVo box with 2 Tuners and Built-In Ethernet

There’s not a ton of info available, except that Amazon lists these product features:

  • Does not support recording from two digital cable or satellite channels at once
  • Record shows from two basic cable channels, or one basic cable and one digital cable channel, at once.
  • Up to 180 hours recording capacity
  • Includes Ethernet and USB ports, so connecting to your home network is a snap
  • Only TiVo offers exclusive features like WishList searches, Season Pass recordings, TiVoToGo transfers, plus new online services like music, photos, and more!

On the other hand, if you’re willing to wait longer and want to spend a bit more money, you might want to wait for the Series 3.

TurboTax 2005 for Mac sucks

TurboTax on the Mac seems to be a big pile of garbage.

First as I was importing my investment income from the Internet, I noticed that it downloaded all the correct amounts from my institution but then added duplicate entries for each of my mutual funds with completely bogus amounts of additional income that I have never received. That is fricking scary. Well, so I deleted the garbage and encountered the next problem…

While doing my ESPP sales, I didn’t know the cost basis for one of my sales so I left it blank and hit the button for “Fill in cost basis later”. Now it takes me back to that sale again. Try again – infinite loop. Now I want to go back in and see a list of all the sales so I can double-check them, but it won’t let me. When I click to edit the ESPP section, it drops me directly into the wizard for the sale with the missing basis.

I might just have to give up on it and switch over to a Windows machine.