Article View: comp.lang.clos
Article #345FIXNUM declarations (was How to neatly destroy instances)
From: john
Date: Thu, 15 Oct 1992 16:52
Date: Thu, 15 Oct 1992 16:52
26 lines
1276 bytes
1276 bytes
Jeff Dalton (jeff@aiai.edinburgh.ac.uk) writes:
... For instance, why should I write code for vectors with as many
as, say, 1000 elements when I can write instead for "vectors as big
as this Lisp can handle"? Why should I have to pick a number?
Well, this probably only works for that particular example, but you
can always build implementation constants into your own type
definitions:
(DEFTYPE VECTOR-INDEX ()
'(INTEGER 0 #.(1- ARRAY-TOTAL-SIZE-LIMIT)))
(DEFUN TRAVERSE-VECTOR (V)
(DECLARE (TYPE VECTOR V))
(DOTIMES (I (1- (LENGTH V)))
(DECLARE (TYPE VECTOR-INDEX I))
...
(ELT V I)
...))
I do this all the time. Then again, by type inference, the compiler
SHOULD be able to figure out the range of I anyway.
John Burger
john@mitre.org
Technical Details
Message-ID:
<9210160052.AA03976@thelonius.mitre.org>Path:
arc1-ca.pugleaf.net!sparky!uunet!ukma!darwin.sura.net!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!linus.mitre.org!johnShow Full Headers
Complete Article Headers
Newsgroups: comp.lang.clos Path: arc1-ca.pugleaf.net!sparky!uunet!ukma!darwin.sura.net!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!linus.mitre.org!john From: john@linus.mitre.org Subject: FIXNUM declarations (was How to neatly destroy instances) Message-ID: <9210160052.AA03976@thelonius.mitre.org> Sender: daemon@cis.ohio-state.edu Organization: The Ohio State University Department of Computer and Information Science Date: Thu, 15 Oct 1992 16:52:14 GMT Lines: 26