debugging
From: Trent Buck (trentbuck_at_gmail.com)
Date: 03/26/05
- Next message: Christophe Rhodes: "Re: LALR(1) parser generators"
- Previous message: Frank Buss: "CL-Canvas or yet another graphics library for Logo and Mandelbrot"
- Next in thread: Pascal Bourguignon: "Re: debugging"
- Reply: Pascal Bourguignon: "Re: debugging"
- Reply: Fred Gilham: "Re: debugging"
- Reply: David Smith: "Re: debugging"
- Reply: Wade Humeniuk: "Re: debugging"
- Reply: Alan Crowe: "Re: debugging"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 26 Mar 2005 08:44:23 GMT
Several times recently I've made the same mistake:
(defun entropy (P &optional (K 2))
"Take a probability alist and a base, return the overall entropy."
(if (null P)
0
(+ (* (cdar P)
(- (log (cdar P) K)))
(entropy (cdr P)))))
instead of
(defun entropy (P &optional (K 2))
"Take a probability alist and a base, return the overall entropy."
(if (null P)
0
(+ (* (cdar P)
(- (log (cdar P) K)))
(entropy (cdr P) K))))
That is, forgetting to include the optional argument when recursing.
Is there an easy way to detect this error?
-- Trent Buck, Student Errant For their next act, they'll no doubt be buying a firewall running under NT, which makes about as much sense as building a prison out of meringue. -- Tanuki
- Next message: Christophe Rhodes: "Re: LALR(1) parser generators"
- Previous message: Frank Buss: "CL-Canvas or yet another graphics library for Logo and Mandelbrot"
- Next in thread: Pascal Bourguignon: "Re: debugging"
- Reply: Pascal Bourguignon: "Re: debugging"
- Reply: Fred Gilham: "Re: debugging"
- Reply: David Smith: "Re: debugging"
- Reply: Wade Humeniuk: "Re: debugging"
- Reply: Alan Crowe: "Re: debugging"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|