Subject: Re: Package literals (Re: Returning functions)
From: Erik Naggum <>
Date: 1999/08/14
Newsgroups: comp.lang.lisp
Message-ID: <>

* 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)

 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")))))))

  (defun pringles (chips)
    (loop (pop chips)))