sanity check (coding style)



so,  I am still learning,  and toying around with lisp,
having fun;  just to check that I might not be completely
off...

ok,  I am using Nathan J. Froyd's sha: package that
computes sha1sum (that can be found here:
http://www.cs.rice.edu/~froydnj/lisp/sha1.lisp)

It does what I want,  except that,  it returns a vector
of integers;  for instance

CL-USER> (sha:sha1sum-sequence "zozo")
#(130 154 235 231 1 41 183 140 144 245 ...)

Now,  what I really would like instead is a string
like this:

"829AEBE70129B78C90F57C5921D18FFAEC89287C"

Now,  I may have missed the very obvious,  but I did
not find something that did that directly,  so I came
up with this:

(defun sha2string (v)
   (let ((s nil))
      (map 'vector
           #'(lambda (n)
           (setf s (concatenate 'string s
                (format nil "~2,'0,,X" n))))
           v)
      s))

(ok,  indentation sucks,  but I wanted it to fit
into fewer columns so that it is not mangled by
email)

It works,  but my questions are:  am I completely
off my rockers? and did I miss the obvious one-liner
that true lisper should know?  if not,  is my
coding style reasonably ok?  completely bad?

thanks,

--Sylvain





.



Relevant Pages

  • Re: Double Decker Double Wide
    ... when it was just him and his 10 string doing the one-man-jam-band gig. ... again in my friend's living room on my birthday in 1999 - he was ... really fun as a small room performer. ...
    (rec.music.gdead)
  • Johnson jg-622-e acoustic bass problem
    ... I was given a 622 yesterday and thought it would be fun to pluck around ... The G string kind of rings, ... (Cherry Cherry, Brown Suzy Q, that sort of thing) ... I play a Fender ...
    (alt.guitar.bass)
  • Re: Tools you didnt know you needed
    ... And it means i get to buy a fun toy when its not work time ... weight and string rig too. ... a pull string needed to be provided in 500' of 8" duct. ... When said rabbit refused to go more than ten ...
    (rec.crafts.metalworking)
  • Re: Post EC-My visit to GC....
    ... it may have a problem picking up the low E string. ... Did they have one for the classical guitar too? ... different and it's kinda fun to find which one works best for you. ... The capo is for the ...
    (rec.music.makers.guitar.acoustic)
  • Re: Tools you didnt know you needed
    ... And it means i get to buy a fun toy when its not work time ... weight and string rig too. ... a pull string needed to be provided in 500' of 8" duct. ... When said rabbit refused to go more than ten ...
    (rec.crafts.metalworking)