;;;;;;;;;;;;;;;;;;; -*- Mode: Lisp; Package: Macsyma -*- ;;;;;;;;;;;;;;;;;;; ;;; (c) Copyright 1980 Massachusetts Institute of Technology ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (macsyma-module char) ;;; hacks for character manipulation. (DEFMFUN $GETCHARN (SYMBOL INDEX) (OR (SYMBOLP SYMBOL) (MERROR "First arg to GETCHARN: ~A, was not a symbol." (implode (mstring symbol)))) (OR (AND (FIXP INDEX) (> INDEX 0)) (MERROR "Second arg to GETCHARN: ~A, was not a positive fixnum." (implode (mstring index)))) ; what happens next is debateable. ; one thing I don't want to do call mstring and take nthcdr. ; what to returns depends on what you would see printed. ; well, or read in. ; the main use for this is to check symbol name conventions, ; so $FOO and &FOO might be the same, same with %FOO I guess, ; but FOO (i.e. ?FOO is different.) poo, all these things ; depend on the setting of global switches. screw it. (LET ((C1 (GETCHARN SYMBOL 1))) (COND ((OR (= C1 #/$) (= C1 #/%) (= C1 #/&)) (GETCHARN SYMBOL (1+ INDEX))) ((= INDEX 1) #/?) (T (GETCHARN SYMBOL (1- INDEX))))))