enbase/baseoccurs in a lot of old R2 code, not always base 16. Without digging in, the use case that jumps out at me is emitting data, because other formats, like XML or JSON, may want values as hex strings, and the return value of
checksumis a key partner there. But that's not really where
formis best applied, since it's for data interchange.
here I would now use:
md5: form checksum skip inBuffer 2 'md5
md5: enbase/base checksum/method skip inBuffer 2 'md5 16
@Oldes, I think we're seeing the same patterns.
@ne1uno where are hex colors used as
binary! in Red? e.g. pixels in images are tuples.
My suggestion is to look at
to-hex and see if it can be extended (I wish it were a mezz, for easier playing). It's used in the Red codebase is in the JSON emitter, for
\u chars, but a dozen places or so in %.r support files in the core. It returns an issue, as R2 did, but bear in mind that they were a string type in R2 and a word type in Red. @ne1uno already noted that it's an alternative approach to
Format will likely have hex output support, as a side note.
For now, I'd wrap
enbase, though we have a number of places "hex" is used in a name, but for different purposes.
form-as-hex could be a name to use as a playground.
-cmay fail for numerous reasons, depends on your code
on-change could append chars and reset face/text: "**"