;;;;;;;;;;;;;;;;;;;;;;;;;;;;; symord.l ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Functions for defining symbols and ordinal types.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (c) 1983 , The Regents of the University of California.
; Authors: Joseph Faletti and Michael Deering.
; Define one SYMBOL in a hunk for easy identification.
; This will not work independently (for some reason).
(or (and (not (litatom symname))
(not (msg t "SYMBOL: Symbols can only be simple names, not:"
(and (eq symname 'nilsym)
(boundp (symatom 'nilsym))
(not (msg t "SYMBOL: Cannot redefine nilsym." t)))
(not (msg t "SYMBOL: Cannot name a symbol nil." t)))
(and (symbolnamep symname)
(msg t "SYMBOL: Warning: Redefining symbol: "
(let ((block (set (symatom symname) (makhunk 3))))
(putuniquenum (newnum) block)
(puttypetag '*pearlsymbol* block)
(putsymbolpname symname block)
; Define a bunch of SYMBOLS.
; An EXPR which allows the defining of one SYMBOL.
(cond ((not (litatom symname))
(msg t "SYMBOLE: symbols can only be simple names, not: "
( t (apply* (onesymbol) (ncons symname)) symname)))
(cond ((symbolnamep symname)
(eval (symatom symname)))
( t (msg t "GETSYMBOL: " symname " is not the name of a symbol." t)
; (ordinal name (x y z)) or (ordinal name (x 1 y 3 z 8)).
; Define a set of integer constants for readability in input and output.
; Also define o:name, name:max and name:min, and name:x, name:y and name:z.
(let ((ordinalname (car l))
(ordinalelements (cadr l))
(push ordinalname *ordinalnames*)
(set (ordatom ordinalname)
(cond ((not (numberp (cadr ordinalelements)))
(tconc alist (cons (setq name (pop ordinalelements))
(set (concat ordinalname ":" name) count))
; use numbers provided by user.
( t (setq min (setq max (cadr ordinalelements)))
(cons (setq name (pop ordinalelements))
(setq value (pop ordinalelements))))
(set (concat ordinalname ":" name) value)
(set (concat ordinalname ":min") min)
(set (concat ordinalname ":max") max)
(cons ordinalname (car alist))))