feedbot: http://thetarpit.org/2021/on-the-tangled-ball-of-music-that-is-rock << The Tar Pit -- On the tangled ball of music that is rock
feedbot: http://btc.info.gf/blog/benvulpes-base58-encoding-in-common-lisp.html << btcinfo -- ben_vulpes base58 encoding in Common Lisp
verisimilitude: That code's horrible; I could do better, and will try to do so later today.
shinohai: verisimilitude: I like to archive things I have used, for good or bad, and sometimes even refer back to 'em as reminders of what did and did not work.
shinohai: As is, it served purpose well for experimenting with addy generation is lisp, though as of yet have nothing concrete out of it.
verisimilitude: I believe I'm finished.
verisimilitude: I made some missteps in trying to simplify it, particularly in the second loop, but that's of little importance.
verisimilitude: It's fine if I submit it inline, right?
verisimilitude: Without paying much attention, I've yet to come across a test case for which the third loop does anything.
shinohai: verisimilitude: will read, though would personally prefer a paste for readability's sake.
trinque: it'd be more interesting to explain why yours is better
verisimilitude: It's not obvious?
trinque: do I need to explain to you how communication works too?
verisimilitude: I know that's obviously not so.
verisimilitude: For one, by using WITH-OUTPUT-TO-STRING, the stream is certainly closed.
verisimilitude: I avoid interning symbols; use DPB to build an integer, which is its purpose; and in general take advantage of every relevant language feature available.
trinque: sometimes even discussions of the obvious are illuminating for the logs
verisimilitude: I didn't bother writing code which avoids all unnecessary allocation, but he has two calls to REVERSE, both unnecessary.
trinque: yeah, seems this should really both eat and shit streams
verisimilitude: That's true; it's not submitted here, after all.
verisimilitude: A more efficient approach would be to determine the string size, and allocate it at once.
trinque: yep, also a good approach
verisimilitude: Anyway, were I to write this better, I'd actually read the base 58 documents, rather than merely mimick.
verisimilitude: How unfortunate; my solution diverges in one other way; it returns the empty string on zero, whereas the original returns "1".
verisimilitude: I'm not certain which this is a bug in.
verisimilitude: If I remove the final loop from the original, the result is the empty string; for some odd reason, this seems to me for now to be the only case where that loop does anything.
verisimilitude: I won't be making any more changes, since my plan is to discard the code later, anyway.