bessel-j-integral-2



On 12/03/2011 6:43 PM, Andreas Eder wrote:
> Hi,
>
> when looking at compiler messages I found something in bessel.lisp
> that might be a bug, or I just don't understand it :-)
>
> The code in bessel-j-integral-2 looks like:
>
>       '((mtimes) ((rat) 1 2) z
>         ((mplus)
> 	((mtimes) $%pi
> 	 ((%bessel_j) 1 z)
> 	 ((%struve_h) 0 z))
> 	((mtimes)
> 	 ((%bessel_j) 0 z)
> 	 ((mplus) 2 ((mtimes) -1 $%pi ((%struve_h) 1 z)))))))
>
> where z is one of the functions arguments.
> Shouldn't that be using a backtick and comma like:
>
>       `((mtimes) ((rat) 1 2) ,z
>
> I don't know the code, but as it is i looks very suspicious to me.
>
> Someone in the know wants to comment?
>
> 'Andreas
A good question.

OK.  I wrote this.  It is correct (or at least gives the correct 
answer), but arguably poor style.

The argument z is unused, which is presumably the source of the compiler 
warning.  The code returns an expression containing the symbol z that is 
used in the calling function.  I think you would get an equivalent 
expression if you used a backtick and a comma to substitute the value of 
argument z into the expression here.

I will think about the cleanest way to clarify the code in question.  
Perhaps just declare that argument z is unused to kill the warning.  
There is similar usage in a couple of other integrals.

     David