Commit d91273b6 authored by Antoine Martin's avatar Antoine Martin
Browse files

Add function to print list to three columns

parent f1b8ead1
......@@ -2,7 +2,9 @@
(:use :cl :split-sequence)
(:import-from :alexandria
(:export :print-primary-systems :get-primary-system-name))
(:export :print-primary-systems
(in-package :quickref)
......@@ -39,3 +41,20 @@
(defun print-primary-systems ()
(dolist (release (ql-dist:provided-releases t))
(print (get-primary-system-name (ql-dist:name release)))))
(defun get-columns-length (size)
(multiple-value-bind (split remainder) (floor size 3)
(case remainder
(0 (values split split split))
(1 (values (+ split 1) (+ split 1) (- split 1)))
(2 (values (+ split 1) (+ split 1) split)))))
(defun print-columns (l size)
(multiple-value-bind (lfirst lsecond)
(get-columns-length size)
(do ((n 0 (+ n 1))
(f l (cdr f))
(s (nthcdr lfirst l) (cdr s))
(th (nthcdr (+ lfirst lsecond) l) (cdr th)))
((= n lfirst) nil)
(format t "~a ~a ~a~%" (car f) (car s) (car th)))))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment