Rust Koans​​​​​

Puom

Neophyte Col came to Master Tuor one day and said: "I have almost finished a program in which I see repeated patterns of code. The patterns are not regular enough to be abstracted by functions or traits. I have a mind to use macros, but am unsure of how to proceed."

Master Tuor considered this. "I believe I know who can help you find clarity. Come."

Together, they walked away from the main temple and past the gardens. On the periphery of the grounds, they came across a strange building. Each plank of wood, each panel, tile, window; all were unique in shape, size, colour, texture, material... "What is this place?" asked the neophyte.

"It is where the Clan of the Falling Snowflake practice the art of Syntactic Abstraction. They abhor repetition above all else." Col nodded as they entered.

Inside, the building was just as relentlessly unique. No two doors were the same shape or size. Each candle and its perch were designed and coloured a different way. Col began to feel dizzy.

Even the monks themselves exemplified this approach. Rather than the plain, dark brown robes the other monks wore, each monk of the Falling Snowflake wore a haphazard collection of materials and colours. Col wondered if perhaps a great storm had swept up a cloth merchant's wares and deposited them on these unsuspecting monks.

His eyes were then caught by the walls. They were covered with programs that seemed to be in some strange language as he might expect from the Temple of APL... but here and there he caught glimpses of familiar syntax, though they made little sense.

The monks' speech was strange as well. Col observed several groups standing silently, staring at each other. He began to wonder if perhaps they were forbidden to speak at all, when he heard an outburst from one group:

"Sie durm! Wik puom, eeis."

With that, the monks standing in the group nodded at one another and walked away.

"Master..." Col began.

"As I said, they abhor repetition. As such, they abhor our language, filled as it is with redundancy, not to mention inaccuracy. Instead, they use their own tongue which is both perfectly precise, and perfectly optimal. They say what they mean and nothing else."

"But they are so quiet, otherwise."

Master Tuor nodded. "Do you think it easy to decide what one wishes to say, with utter and complete precision, before speaking a word?"

As they passed through a tiny, five-sided doorway, they came upon a monk dressed in cloth dyed in a thousand shades of dark grey. Wrapped around the robes was a mesmerising pattern in white thread that seemed to spiral forever away into the cloth; an infinite, curving beast made of straight lines and squares.

"Neophyte, this is Master Quoem, head of the Clan of the Falling Snowflake." The monk nodded in greeting. "Tell him of your problem."

Col took a breath. "I have nearly completed a program in which I see much repetition.

"In some cases, the logic must call different functions, though all around it remains unchanged. In others, different types implement similar methods, yet they cannot be unified by traits.

"I have been told that macros may be a solution to my problem. What would you advise?"

Master Quoem was silent. For many long minutes, he stared intently at Col. It went on for so long that Col began to shuffle nervously under the master's gaze, uncertain if he had somehow offended him.

The master, Col noticed, had slightly odd eyebrows...

Finally, Master Quoem spoke thus:

"Fheiq kah, puom."

Then he nodded at Col, turned, and walked away.

"Thank you for your counsel, Master Quoem," said Master Tuor as he guided Col back the way they came.

As they walked, Col tried to understand what had happened. Stepping back out into the sunlight, he came to a conclusion.

"Did speaking to Master Quoem help you find your answer?" Master Tuor asked him.

"Yes," replied Col. "I have finished my program."

Master Tuor nodded; the neophyte had been enlightened.

66 Likes