Common Lisp Blockchain - Scheme Coin

Burton Samograd burton.samograd at gmail.com
Tue Dec 19 04:18:07 UTC 2017



> On Dec 18, 2017, at 3:31 PM, David McClain <dbm at refined-audiometrics.com> wrote:
> 
> umm… was this supposed to be some kind of joke?

Not intentionally, but I think I cleared that up earlier  :)


> I’ll bite... I don’t get it. I was actually hoping to learn something here…

What didn’t you learn?  What were you expecting to see?

> 
> But the code does look rather peculiar on close inspection.

I’ve got my own style.  I rarely work with other people(’s) code in CL, so this is how I write it.

> Why the use of macros for pushing new transaction blocks?

So I don’t have to quote arguments in the REPL when typing in the calls manually.  It also saves the caller from having to remember which arguments to quote when calling, just their form.

> And the conversions to octet vectors may work for strings, but not in general for arbitrary integer or float values…

I’m not sure what you mean there.  This code?

(defun to-byte-array (x)
  (let ((retval (make-array 0 :adjustable t 
                            :fill-pointer t 
                            :element-type '(unsigned-byte 8))))
    (map 'nil (lambda (c) (vector-push-extend (char-code c) retval))
         (format nil "~A" x)) ;
    (coerce retval 'ironclad::simple-octet-vector)))

I would think the ~A in the format would give a solid textual representation for any type that has a printable expression. Am I incorrect in that?

> 
> If it is supposed to be a joke, I’ll chuckle and just chuck the code…

I hope you enjoyed reading it as much as I enjoyed writing it.  I hope others find it useful.

> 
> - DM
> 

—
Burton Samograd

> 




More information about the pro mailing list