Comment by e12e
20 days ago
True enough. On that note, I had a look at the language reference - there's arrays - but also this:
(char_at s index) # Get ASCII value at index (0-based)
(string_from_char code) # Create string from ASCII value
So, you can pluck a character... From an UTF-8 string? What if the rendering used multibyte characters?
Well, we can see the string, and we can see that is uses plain ASCII.
In this case, sure. But what if we shifted to rendering with emojis or whatnot. What would the first ASCII character of the string be?
If you anticipate that need, you just store the gradient as an array of strings, and you still then only need a trivial lookup.
1 reply →