Nelson Alexandra <***@i2pn2.org> wrote:
| Lieven Marchand ***@wyrd.be writes:
| >You can use DECLARE with ftype.
| >From the hyperspec examples:
| >(declare (ftype (function (integer list) t) ith)
| > (ftype (function (number) float) sine cosine))
| >So ith is a function that takes an integer and a list and returns
| Ah, I didn't noticed FTYPE yet, thank you.
Also, a *very* important point to be aware of generally
[especially if you're coming to CL from statically-typed
languages] is that in CL a type declaration is *NOT* an
instruction to the compiler to do things a certain way;
rather, it's a promise by you the programmer *TO* the
compiler that what you claim in the declaration is true,
and that the compiler can depend on it being true without
even checking it!! [For example, the compiler is allowed
to use your declaration to optimize the code without
questioning your declaration (though *some* compilers
might give you warnings in some cases, if they can detect
In short, if you lie to the compiler, prepare for nasal demons...
CLHS: 126.96.36.199 Semantic Constraints
- The argument syntax and number of return values for all
functions whose ftype is declared at compile time must
remain the same at run time.
- Type declarations present in the compilation environment
must accurately describe the corresponding values at run
time; otherwise, the consequences are undefined. ...
 All uses of "compiler" above should be understood to mean
"compiler or evaluator" [interpreter].
Rob Warnock <***@rpw3.org>
627 26th Avenue <http://rpw3.org/>
San Mateo, CA 94403