Archive for May, 2007

distinguishing usual numbers, infinities and NaN

Wednesday, May 30th, 2007

In a Scheme program, I need to distinguish infinities and NaN values. In Guile, it’s simple, it’s just the functions inf? and nan?. But when I took another implementation, I got troubles. I spent a lot of time and tried everything — =, eq?, equal?, but nothing helped. Fortunately, after a break, I found a simple universal solution.

(more…)

breaking expectations

Tuesday, May 22nd, 2007

How do you thing, what the following Python/libxml2 code does?

for kid in node.get_children():
  print kid.name

(more…)