[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Questions from M. Hagiya

    Re:   Questions from M. Hagiya

    If we evaluate (setf (symbol-function 'moshi) (symbol-function 'if)),
    does Common Lisp specify that this "works", i.e. that the symbol "moshi"
    (a Japanese word for "if") can now be used as the name-symbol of a
    special form, just as well as "if"?  (I told him I thought the answer
    was "no", but it's not stated clearly in the manual.)

The manual explicitly states (on page 90) that is is an error to invoke the
thing that symbol-function returns if macro-p or special-form-p of that symbol
is true.  That seems lucid enough.

    Is this an example of legal syntax:  #c(0 #.pi)

I don't know if that's a legal complex number (the components are of different
types), but I believe it's just as easy (perhaps easier) to make a reader
accept #c(0.0l0 #.pi) instead of scream about it.

    Should the streams that are arguments to make-broadcast-stream,
    make-concatenated-stream, or make-echo-stream be of the same element

I would say no.  One can imagine that reading from a concatenated stream made
of different bytes sizes could be put to some good use.

    What is the element type of "bit sink" (that is, make-broadcast-stream
    of no arguments)?  (I told him that T seemed right to me, but agreed
    that the point needs clarification.)  Also, what is the element type of
    a concatenated stream made of no streams?  (I'm not sure it matters.)

Using the AND'ing of types that Spice Lisp does, a Make-Broadcast-Stream of no
streams can be thought to have an element type of (AND), which simplifies to T.
AND of no arguments as a type specifier is not described, but interpreting the
identity of that type specifier to be T seems right.

    If the reader sees a close-paren at top-level, must this signal an
    error, may it be ignored, or what?

As a user, I would like to have this behavior on a switch.  Spice Lisp ignores
them, but Zetalisp (and the CLCP) signal errors.  I've found the Zetalisp
behavior generally annoying but sometimes helpful.

    While LOADing a file, what is the value of *standard-input*?  (I told
    him that I thought for a character file it really ought to be the file
    stream, but the manual needs to say and doesn't.  What should it be when
    the file is binary?)

I don't think anything should happen to *Standard-Input*.  Consider a program
(i.e. a file of Lisp code) that wants to query the user when it is loaded.  In
that case, leaving *Standard-Input* as is is useful.  I can't think of any
useful thing one could do with having *Standard-Input* be bound to the file.

    Can a symbol be a function and a macro at the same time?  (Of course I
    told him no.  His internal representation is actually sort of set up
    to allow this, but of course the interpreter has to do exactly one thing
    with a form, so actually his implementation doesn't do anything unusual.)

Allowing a symbol to be both a special form and a macro is useful however, so
that things can be interepreted quickly and a portable code-analyzer can pick
them apart.

    How do you implement "rationalize"?  (I didn't know off hand.  By the
    way, this makes me suspect that these folks don't have a copy of the CMU

Perhaps they didn't dig far enough into SPNUM, which has other things like
lisp-level code for bignum arithmetic that wouldn't necessarily interest
other implementors.  It's there, preceded by this comment:

;;; Thanks to Kim Fateman, who stole this function rationalize-float
;;; from macsyma's rational. Macsyma'a rationalize was written
;;; by the legendary Gosper (rwg). Gosper is now working for xerox
;;; at parc. Guy Steele said about Gosper, "He has been called the
;;; only living 17th century mathematician and is also the best
;;; pdp-10 hacker I know." So, if you can understand or debug this
;;; code you win big.

    He was confused by the term "alphadigit" in Table 22-3, apparently not
    having read the fine print at the bottom.  I presume that the function
    alpha-char-p needs to reference *read-base* in order to function properly?

No.  The definition of Alpha-Char-P is straightforward enough.  At the end:

	"Of the standard characters, the letters A through Z and
	 a though z are alphabetic."

I don't see at all how frobbing *Read-Base* can change this.