From: Heiko Schaefer
Subject: Optimising passed function
Date: 
Message-ID: <866657rrjd.fsf@koepke.myip.org>
Dear Lispers,

I am passing a function to another function and would 
like to ensure fastest compilation. 
How can I tell the compiler that the passed 
function returns a double-float?

Example
(defun bla (gugu)
   (funcall gugu 10.0d0))

I already do
...
   (the double-float (funcall gugu 10.0d0))
but the compiler (CMUCL) is still not happy.

Thanx for your help,

Heiko


PS  ... or would you do this with overloading a generic function and not
passing a function? Are generic functions slow?

From: Erik Naggum
Subject: Re: Optimising passed function
Date: 
Message-ID: <3222232705639318@naggum.net>
* Heiko Schaefer <··············@swissonline.ch>
| I am passing a function to another function and would 
| like to ensure fastest compilation. 
| How can I tell the compiler that the passed 
| function returns a double-float?

  (declare (type (function <arglist> double-float) <variable>))

  See the entry for the system class function in the hyperspec.

///
-- 
  In a fight against something, the fight has value, victory has none.
  In a fight for something, the fight is a loss, victory merely relief.
From: Wolfhard Buß
Subject: Re: Optimising passed function
Date: 
Message-ID: <m3n0yjroci.fsf@buss-14250.user.cis.dfn.de>
Heiko Schaefer <··············@swissonline.ch> writes:

> How can I tell the compiler that the passed 
> function returns a double-float?
> 
> Example
> (defun bla (gugu)
>    (funcall gugu 10.0d0))

Python understands

 (defun bla (gugu)
   (declare (type (function * double-float) gugu))
    (funcall gugu 10.0d0))