4 ms·
>> print(“Hello, world!”.ai_reverse()) world, Hello!
by harryf 3y ago
>> print(“Hello, world!”.ai_reverse())
world, Hello!
- ben_w 3y agoFirst few versions of Swift kept changing how strings work because it's not entirely obvious what most people intend from the nth element of a string. Used to be easy, when it was ASCII. Reverse the bytes of utf-8 and it won't always be valid uft-8. Reverse the code-points, and the Canadian flag gets replaced with the Ascension Island flag.
- samus 3y agoCharacter-level operations are difficult for LLMs. Because of tokenization they don't really "perceive" strings as a list of characters. There are LLMs that ingest bytes, but they are intended to process binary data.