Subject: Re: 12:31:23
From: Erik Naggum <erik@naggum.net>
Date: 31 Dec 2000 14:28:19 +0000
Newsgroups: comp.lang.lisp
Message-ID: <3187261699703063@naggum.net>

* "Vladimir V. Zolotych" <gsmith@eurocom.od.ua>
| (let* ((n (/ (* 3600 200) 170))
|        (h (truncate n 3600))
|        (m (rem (truncate n 60) 60))
|        (s (truncate (rem n 60))))
|   (format t "~&~D:~D:~D~%" h m s))
| 
| this prints 
| 1:10:35

(multiple-value-bind (mm ss) (floor (round (* 3600 200) 170) 60)
  (multiple-value-bind (hh mm) (floor mm 60)
    (format t "~2,'0D:~2,'0D:~2,'0D" hh mm ss)))

  Note the use of round instead of / which produces an integer instead of a
  rational number directly.

| Is it possible to make this fragment more clear?

  Is the above more clear?

| What is the right way to use only some values from those
| returned by (values 1 2 3) ? E.g. second or first ?

  If you need only one value, use nth-value.  If you need more than one
  value, any values you don't use are discarded, so you can use
  multiple-value-bind or -setq to get the values you need.  

#:Erik
-- 
  Performance is the last refuge of the miserable programmer.