Doe LLMs write valid Gleam programs? Trying with ChatGPT three years ago, it did not. Workarounds, like "here is the syntax as a system prompt", put into the prompt I would not consider understanding, as Gleam idioms and patterns will certainly not all fit.
GP is crazy, but if you are basing your view of what LLMs can do based on ChatGPT 3 years ago, that is just as much out of touch.
The entire Gleam language tour (https://tour.gleam.run/everything/) is comprehensive. It contains examples of every language feature and prints to less than 70 pages - easily fits into the context window of any recent LLM.