File: descriptive_util.lisp

package info (click to toggle)
maxima 5.47.0-9
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 193,104 kB
  • sloc: lisp: 434,678; fortran: 14,665; tcl: 10,990; sh: 4,577; makefile: 2,763; ansic: 447; java: 328; python: 262; perl: 201; xml: 60; awk: 28; sed: 15; javascript: 2
file content (16 lines) | stat: -rw-r--r-- 665 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
;; descriptive.lisp -- additional functions needed by package descriptive

(defun $unique_in_sorted_array (a)
  (let ((prev (gensym)))
    (cons '(mlist) (loop for x across a when (not (alike1 prev (setq prev x))) collect x))))

(defun $vector_min_max (a)
  (if (> (length a) 0)
    (let ((min-a '$inf) (max-a '$minf) ($ratprint nil))
      (loop for x across a
            do (let ((cmp-min ($compare x min-a))
                     (cmp-max ($compare x max-a)))
                 (when (string= cmp-min "<") (setq min-a x))
                 (when (string= cmp-max ">") (setq max-a x))))
      (list '(mlist) min-a max-a))))
  ;; Otherwise return NIL if A is empty.