T Looking at the ...">

What is the nature of pointers?

Svante just blew my mind, showing string pointers in another answer:

(string= :& "&") -> T

Looking at the CLHS, they say A designator is an object that denotes another object.it's fine, but since they are different objects, some kind of coercion has to happen somewhere. By this I mean that if the next list pointer can be satisfied with a "non-zero atom", some kind of logic exists somewhere to handle this.

list notation n. designation for a list of objects; that is, an object that denotes a list, and which is one of: a non-zero atom (denoting a singleton list, whose element is a non-zero atom) or a regular list (denoting itself).

I thought that a notation could be a concept that results, for example, in common functions .. but the next line from CLHS ...

Unless otherwise specified, in a situation where the designated object can be used several times, it depends on the implementation, regardless of whether the object is forcibly executed only once or each coercion occurs during which the object is to be used.

... does then seem very concrete.

So my questions

  • What is an example of how developers can be implemented in an implementation?
  • Is this mechanism in any way accessible to users?
  • Is this mechanism consistent between different designations? (looking at clhs, there seem to be 18 kinds of notation).

Greetings

+4
source share
3

( ), , . ; - , . :

designator n. , . , , , ; , . . 1.4.1.5 ().

:

1.4.1.5

- , .

, , , - ; , . ( , "" "" " "" "" " "" & & raquo; ").

. , - , :

n. ; , : ( , ), a ( , ), ( ). , ; , , .

, , :

, x; :

  • x , .
  • x , .
  • x , , . , .

, . , , make-person :

(defun make-person (name)
  "Return a person with the name designated by NAME."
  (list :name (string name)))

(defun person-name (person)
  "Return the name of a person (a string)."
  (getf person :name))

- , , API. Lisp , Lisps, , , .

, case

n. ; , , , : , ( , , ) ( ).

case keyform {normal-clause} * [other-clause] = > result *

normal-clause:: = (keys form *)

keys — . , t . , (t) ( ), .

, , , ( t , case, ):

(defun to-list (x)
  "Return the list designated by x."
  (if (listp x) x
    (list x)))

, , , , "" . , :

(defmacro deftransform (name &rest args)
  `(setf (gethash ',name *transforms*)
         (make-transform ,@args)))

(defmacro deftransform (name &rest args)
  (setf (get ',name 'transform) (make-transform ,@args)))

( * transforms * ). :.

(defun transform (x)
  (if (transformp x) x
    (gethash name *transforms*)))

(defun transform (x)
  (if (transformp x) x
    (get x 'transform)))

.

+6

, , . .

, character ( a) string, string character, one-char.

How: System-level

-, . , -

(defun human-address (human)
  (etypecase human
    (human ...)
    (string (human-address (gethash human *humanity*)))))

(defun human-address (human)
  (when (stringp human)
    (setq human (gethash human *humanity*)))
  (unless (human-p human)
    (error ...))
  ...)

defgeneric - .

:

. I.e., .

, :

(defclass human ...)
(defvar *humanity* (make-hash-table ...))
(defgeneric human-address (human)
  (:method ((human human))
     ...)
  (:method ((name string))
    (human-address (gethash name *humanity*))))

a string human.

+3

, .

nil (.. ), , , .

. , , REPL -.

.

( , , , ):

:

  • , . , .

  • . , .

  • , , . :

    , , , , , , with-open-file ( ), .

    , , , , .

  • , . , , , .

    , , , . , , , . string-upcase nstring-upcase.

:

  • , (nil) .

  • nildenotes standard readable text; you can not but indicate reading. Or otherwise, inconspicuous nilwill not signal an error.

  • flow indicator

    nilused as a context-sensitive pointer, you can not not specify a stream in such cases. Or otherwise, inconspicuous nilwill not signal an error.

  • stream variable pointer

    Same reasons as a stream pointer.

+2
source

All Articles