Re: sanity check (coding style)
- From: tar@xxxxxxxxxxxxx (Thomas A. Russ)
- Date: 29 Nov 2005 11:15:18 -0800
Christophe Rhodes <csr21@xxxxxxxxx> writes:
(defun digest2string (v)
(with-output-to-string (s)
(loop for x across v
do (format s "~2,'0X" x))))
This is nice, since it uses the string stream to collect the values. If
efficiency is really critical, one could avoid the FORMAT call (which
often tends to be slow) and subsitute a 256 element lookup table:
(defconstant *hex-codes* #("00" "01" ... "FF"))
(defun digest2string (v)
(with-output-to-string (s)
(loop for x across v
do (write-string (aref *hex-codes* x) s))))
--
Thomas A. Russ, USC/Information Sciences Institute
.
- Follow-Ups:
- Re: sanity check (coding style)
- From: Peter Seibel
- Re: sanity check (coding style)
- References:
- sanity check (coding style)
- From: Sylvain
- Re: sanity check (coding style)
- From: Christophe Rhodes
- sanity check (coding style)
- Prev by Date: Re: Another conversion to C or Java...
- Next by Date: Re: Another conversion to C or Java...
- Previous by thread: Re: sanity check (coding style)
- Next by thread: Re: sanity check (coding style)
- Index(es):
Relevant Pages
|