From ... Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!npeer.kpnqwest.net!EU.net!nreader1.kpnqwest.net.POSTED!not-for-mail Newsgroups: comp.lang.lisp Subject: Re: newbie question References: Mail-Copies-To: never From: Erik Naggum Message-ID: <3234204119285041@naggum.net> Organization: Naggum Software, Oslo, Norway Lines: 35 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 27 Jun 2002 22:01:59 GMT X-Complaints-To: newsmaster@KPNQwest.no X-Trace: nreader1.kpnqwest.net 1025215319 193.71.199.50 (Fri, 28 Jun 2002 00:01:59 MET DST) NNTP-Posting-Date: Fri, 28 Jun 2002 00:01:59 MET DST Xref: archiver1.google.com comp.lang.lisp:35831 * alinabi | How should I set a to make the previous test return nil? The type you want is one of the float types. The superclass float is not useful for specialization. One of the types short-float, single-float, double-float, or long-float is what you want. You must specify it with :element-type if you want the array to be specialized for that type. (This is pretty clear from the specification. Please do not try to guess how things work when there is a specification available.) An array does not become specialized just because you stuffed it with objects of a particular type at one point -- the Common Lisp runtime system has no way of determining what you wuold like to do with it and whether specializing it without your request would break something. Neither does it know that a specialized array you have just created will be the only binding of the variable -- it could figure it out, but it is easier for you to tell it if you know, anyway. Note that if you try to mix a floating point number and a string in an array that you have specialized for some floating-point type, you have lied to the compiler. How and when it will exact its revenge is not specified. Again, see the specification. Even if you can lie to some compilers all of the time and all compilers some of the time, you cannot lie to all compilers all of the time. Note that the variable *read-default-float-format* holds the type that the Common Lisp reader returns if you use an unadorned floating point number. As a general observation, however, you are probably barking up the wrong tree and need some readjustment to your expectations. Please consider a textbook on Common Lisp which can clear up the confusions that led to where you asked this question. -- Guide to non-spammers: If you want to send me a business proposal, please be specific and do not put "business proposal" in the Subject header. If it is urgent, do not use the word "urgent". If you need an immediate answer, give me a reason, do not shout "for your immediate attention". Thank you.