Skip to content

Instantly share code, notes, and snippets.

View terrelcodes's full-sized avatar

Terrel Shumway terrelcodes

View GitHub Profile
@terrelcodes
terrelcodes / hexcolor.arr
Created January 31, 2023 08:41
First attempt at contributing to Pyret
fun code-point-to-hex-digit( d :: Number ) -> Number:
doc: "convert a code point (letter) to a hex digit"
ask:
| (d >= 48) and (d <= 57) then: d - 48
| (d >= 97) and (d <= 103) then: d - 87
| (d >= 65) and (d <= 71) then: d - 55
end
where:
code-point-to-hex-digit(string-to-code-point('0')) is 0