|
1 | 1 | ;;; -*- Mode: Lisp; Package: PLOT/TEXT; Syntax: ANSI-Common-Lisp; -*- |
2 | | -;;; Copyright (c) 2021-2022 by Symbolics Pte. Ltd. All rights reserved. |
| 2 | +;;; Copyright (c) 2021-2023 by Symbolics Pte. Ltd. All rights reserved. |
| 3 | +;;; SPDX-License-identifier: MS-PL |
| 4 | + |
3 | 5 | (in-package #:plot/text) |
4 | 6 |
|
5 | 7 | (defun leaf-strings (all-stems all-leaves sort-order) |
6 | 8 | "Returns a hashtable where the key represents the stem, and the value |
7 | 9 | represents the leaves as a string." |
8 | | - (let ((max-stem (sequence-maximum all-stems)) |
| 10 | + (let ((max-stem (seq-max all-stems)) |
9 | 11 | (strings (make-hash-table :size 1000))) |
10 | | - (loop for s from (sequence-minimum all-stems) to max-stem |
| 12 | + (loop for s from (seq-min all-stems) to max-stem |
11 | 13 | for stems = (which all-stems :predicate #'(lambda (x) (= x s))) |
12 | 14 | for leaves = (if (= (length stems) 0) |
13 | 15 | nil |
|
28 | 30 | (check-type x vector) |
29 | 31 | (let* ((all-stems (efloor (e/ x (if split-stems (/ stem-size 2) stem-size)))) |
30 | 32 | (all-leaves (emod x stem-size)) |
31 | | - (stem-fmt (format nil "~~~AD |" (length (format nil "~A" (sequence-maximum all-stems))))) |
| 33 | + (stem-fmt (format nil "~~~AD |" (length (format nil "~A" (seq-max all-stems))))) |
32 | 34 | (leaf-strings-vector (leaf-strings all-stems all-leaves #'<))) |
33 | | - (loop for s from (sequence-minimum all-stems) to (sequence-maximum all-stems) |
| 35 | + (loop for s from (seq-min all-stems) to (seq-max all-stems) |
34 | 36 | do (progn (format t stem-fmt (if split-stems (floor (/ s 2)) s)) |
35 | 37 | (format t "~A~%" (gethash s leaf-strings-vector)))))) |
36 | 38 |
|
|
52 | 54 | (combined-stems (concatenate 'vector left-stems right-stems)) |
53 | 55 | (left-leaves (emod x stem-size)) |
54 | 56 | (right-leaves (emod y stem-size)) |
55 | | - (stem-fmt (format nil " | ~~~AD |" (length (format nil "~A" (sequence-maximum combined-stems))))) |
| 57 | + (stem-fmt (format nil " | ~~~AD |" (length (format nil "~A" (seq-max combined-stems))))) |
56 | 58 | (left-strings (leaf-strings left-stems left-leaves #'>)) |
57 | 59 | (right-strings (leaf-strings right-stems right-leaves #'<)) |
58 | | - (left-min-col (sequence-maximum (loop for leaf being each hash-value of left-strings collect (length leaf))))) |
59 | | - (loop for s from (sequence-minimum combined-stems) to (sequence-maximum combined-stems) |
| 60 | + (left-min-col (seq-max (loop for leaf being each hash-value of left-strings collect (length leaf))))) |
| 61 | + (loop for s from (seq-min combined-stems) to (seq-max combined-stems) |
60 | 62 | do (progn (format t "~v@A" left-min-col (gethash s left-strings "")) |
61 | 63 | (format t stem-fmt s) |
62 | 64 | (format t "~A~%" (gethash s right-strings "")))))) |
0 commit comments