1
0
mirror of https://github.com/PDP-10/its.git synced 2026-01-13 23:36:30 +00:00

Adds macsyma ARRAY share package.

Resolves #1006.
This commit is contained in:
Eric Swenson 2018-07-07 11:07:20 -07:00
parent 032eb180f8
commit b2edf07193
2 changed files with 64 additions and 0 deletions

View File

@ -583,6 +583,13 @@ respond "_" "share;eigen fasl_share;eigen trlisp\r"
respond "_" "\032"
type ":kill\r"
### build share;array fasl for macsyma
respond "*" ":maxtul;mcl\r"
respond "_" "share;_maxsrc;array\r"
respond "_" "\032"
type ":kill\r"
### more lisplib stuff
respond "*" "complr\013"
respond "_" "liblsp;_libdoc;%print\r"

57
src/maxsrc/array.5 Normal file
View File

@ -0,0 +1,57 @@
;;;;;;;;;;;;;;;;;;; -*- Mode: Lisp; Package: Macsyma -*- ;;;;;;;;;;;;;;;;;;;
;;; (c) Copyright 1981, 1983 Massachusetts Institute of Technology ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(macsyma-module array)
;;; Macsyma User array utilities originally due to CFFK.
(defmfun $listarray (ary)
(Cons '(mlist)
(cond ((mget ary 'hashar)
(mapcar #'(lambda (subs) ($arrayapply ary subs))
(cdddr (meval (list '($arrayinfo) ary)))))
((mget ary 'array) (listarray (mget ary 'array)))
(t
(merror "Argument to LISTARRAY must be an array:~%~M" ary)))))
(defmfun $fillarray (ary1 ary2)
(let ((ary
(or
(mget ary1 'array)
(merror "First argument to FILLARRAY must be a declared array:~%~M" ary1))))
(fillarray
ary
(cond (($listp ary2) (cdr ary2))
((mget ary2 'array))
(t
(merror
"Second argument to FILLARRAY must be an array or list:~%~M" ary2))))
ary1))
(defmspec $rearray (l) (setq l (cdr l))
(cond ((> (length l) 6)
(merror "Too many arguments to REARRAY:~%~M" l))
((< (length l) 2)
(merror "Too few arguments to REARRAY:~%~M" l)))
(let ((name (car l))
(ary (cond ((mget (car l) 'array))
(t
(merror "First argument to REARRAY must be a declared array:~%~M"
(car l))))))
(setq l (cdr l)
l (mapcar #'(lambda (x)
(setq x (meval x))
(cond ((not (eq (typep x) 'fixnum))
(merror
"Non-integer dimension to REARRAY:~%~M"
x)))
(1+ x))
l))
(let ((new-array
(apply '*rearray (cons ary
(cons (car (arraydims ary)) l)))))
#+Franz(mputprop name new-array 'array)
)
name))