Skip to content

Commit 82f84b3

Browse files
author
Symbolics
committed
Update with new function name
1 parent a26cb0e commit 82f84b3

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

src/text/stem-and-leaf.lisp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
;;; -*- 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+
35
(in-package #:plot/text)
46

57
(defun leaf-strings (all-stems all-leaves sort-order)
68
"Returns a hashtable where the key represents the stem, and the value
79
represents the leaves as a string."
8-
(let ((max-stem (sequence-maximum all-stems))
10+
(let ((max-stem (seq-max all-stems))
911
(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
1113
for stems = (which all-stems :predicate #'(lambda (x) (= x s)))
1214
for leaves = (if (= (length stems) 0)
1315
nil
@@ -28,9 +30,9 @@
2830
(check-type x vector)
2931
(let* ((all-stems (efloor (e/ x (if split-stems (/ stem-size 2) stem-size))))
3032
(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)))))
3234
(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)
3436
do (progn (format t stem-fmt (if split-stems (floor (/ s 2)) s))
3537
(format t "~A~%" (gethash s leaf-strings-vector))))))
3638

@@ -52,11 +54,11 @@
5254
(combined-stems (concatenate 'vector left-stems right-stems))
5355
(left-leaves (emod x stem-size))
5456
(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)))))
5658
(left-strings (leaf-strings left-stems left-leaves #'>))
5759
(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)
6062
do (progn (format t "~v@A" left-min-col (gethash s left-strings ""))
6163
(format t stem-fmt s)
6264
(format t "~A~%" (gethash s right-strings ""))))))

0 commit comments

Comments
 (0)