Thu 11 Sep 2008

Reasons to love Lisp

I just wrote a function, similar to memoization, that takes a function as input and allows it to successfully return a value only once in a given duration. A little syntactic sugar lets me write something like
(make-no-more-than
  :hourly
  (email-if
    (make-emailer "rnewman@…")
    (list 'foo-above-80%
          …)))

I.e., I'll get an email at most once every 60 minutes above foo rising above 80%.

Now I don't need to be careful how often this check runs — I know my inbox won't be flooded.

The reason this is awesome is twofold: one, it's something like 10 lines of code; two, it's a completely natural solution to the problem, and I didn't have to think about it at all.

I dread to think about the mess of classes and XML configuration files one would need to do this flexibly in Java.

Posted at 2008-09-11 12:24:30 by Richard NewmanLink to Reasons to love Li…

mds might be on holiday

That's the delightful message Mail.app logs when Spotlight isn't responding. Apparently it's still indexing… me, I think it's wedged. Heh.

Posted at 2008-09-11 14:51:30 by Richard NewmanLink to mds might be on ho…