From ... Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!news.tele.dk!small.news.tele.dk!193.213.112.26!newsfeed1.ulv.nextra.no!nextra.com!uio.no!nntp.uio.no!ifi.uio.no!not-for-mail From: Erik Naggum Newsgroups: comp.lang.lisp Subject: Re: Help with using format control strings Date: 16 Oct 2002 02:34:11 +0000 Organization: Naggum Software, Oslo, Norway Lines: 46 Message-ID: <3243724451319802@naggum.no> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: maud.ifi.uio.no 1034735652 17573 129.240.65.5 (16 Oct 2002 02:34:12 GMT) X-Complaints-To: abuse@ifi.uio.no NNTP-Posting-Date: 16 Oct 2002 02:34:12 GMT Mail-Copies-To: never User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: archiver1.google.com comp.lang.lisp:43983 * Jon Allen Boone | Every CL implementation I've tried fails on this example [apparently | because the 0 needs to be single-quoted to make it a character?]. That example is one of the very small number of actual bugs in the standard. Note, however, that examples are not authoritative in any way and are not formally part of the standard. This is an editorial decision I support wholeheartedly. Examples are generally a bad thing outside of carefully controlled educational settings (as tutorials) because people just as easily learn wrong things from them as the intended purpose if they are not sufficiently guided in what they are supposed to learn. In this case, you have not read the specification, but have "believed" the example. There is really nothing more important to say on this than that this is the wrong order of preference. The right order of preference in a specification and especially a standard is the normative clauses, then the normative clauses, then the normative clauses again just to make sure, and only if you got the point from the normative clauses, you can look at the non-normative clauses, in which you should report anything not immediately reconcilable with the normative clauses as a mistake in the standard, not with your understanding of it. | This came up in some exercises I'm working through in a new book, | _Hacker's Delight_ by Henry S. Warren, Jr. [ISBN 0-201-91465-4] which is | in spirit a follow-on to the 1972 MIT Research memo HAKMEM [according to | Guy L. Steele, Jr., who wrote the Foreword]. Thanks for the reference. I had somehow missed this book. | Rather than just memorize the formulas, I am attempting to convince | myself that they are correct by looking at the binary representation of | numbers and performing the operations in my head. So, I wanted to use | 32-bit padded binary representation to print out the numbers. Since you are on the topic of cute hacks, try (format "~41,'0,' ,4:B" (dpb (byte 32 0) (ash 1 32))) This also solves your negative 32-bit integer printing problem neatly. Exercise: Explain why. :) -- Erik Naggum, Oslo, Norway Act from reason, and failure makes you rethink and study harder. Act from faith, and failure makes you blame someone and push harder.