From ... From: Erik Naggum Subject: Re: Package literals (Re: Returning functions) Date: 1999/08/14 Message-ID: <3143632872802185@naggum.no>#1/1 X-Deja-AN: 512746867 References: <37B0F612.5FAB4E58@EECS.Berkeley.Edu> <37B2F291.BB510728@citydesktopinc.com> <37B2FCCA.169F5D32@EECS.Berkeley.Edu> mail-copies-to: never Organization: Naggum Software; +47 8800 8879; +1 510 435 8604; http://www.naggum.no Newsgroups: comp.lang.lisp * Lieven Marchand | A way to avoid this is using a true string as in (find-package "B"). | Some people don't like the upper case you then have to use and so a third | way is to use symbols in the keyword package as in (find-package :b). I don't like to type upper-case, don't like to use symbols (including keywords), and don't want to change my Lisp to use lower-case internally, so I set up a reader macro that reads the symbol-name the same way the reader does, but only the name which would have been given to INTERN. in Allegro CL, this name is returned by EXCL::READ-EXTENDED-TOKEN. as in: (find-package #"whatever"). this function will parse single and multiple escape, too, of course, but using both multiple escape when the idea is to avoid using the string seems silly to me, so I don't recommend #"|GetRandomWindowsCruft|" over "GetRandomWindowsCruft", but then again, I don't recommend that case- sensitive symbols be used in Lisp in the first place -- use a more Lispy name: get-random-windows-cruft. (in-package :excl) (loop with readtables = (get-objects 11) for i from 1 to (aref readtables 0) for *readtable* = (aref readtables i) when (readtable-dispatch-tables *readtable*) do ;; reader for symbol names that does case conversion according to the rest of the symbol reader. ;; thanks to John K. Foderaro for the pointer. (set-dispatch-macro-character #\# #\" (named-function symbol-namestring-reader (lambda (stream character prefix) (declare (ignore prefix)) (prog1 (read-extended-token stream) (unless (char= character (read-char stream)) (internal-reader-error stream "invalid symbol-namestring syntax"))))))) #:Erik -- (defun pringles (chips) (loop (pop chips)))