Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Optimising passed function

0 views
Skip to first unread message

Heiko Schaefer

unread,
Feb 9, 2002, 3:24:54 AM2/9/02
to

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?


Erik Naggum

unread,
Feb 9, 2002, 3:38:24 AM2/9/02
to
* Heiko Schaefer <heiko.s...@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.

Wolfhard Buß

unread,
Feb 9, 2002, 4:33:49 AM2/9/02
to
Heiko Schaefer <heiko.s...@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))

0 new messages