35. Unary Deduplication
The workshop was lit earlier than usual. Afternoon light reached deep enough to soften the dust in the air, turning it almost gentle. Liina sat at the small table, her coat folded beside her, watching Mihkel prepare a length of tape. This time, she had not brought a finished question.
„I don’t only want the result,“ she said. „I want to understand how you arrive at it. What you ask the machine to do.“
Mihkel paused. He was used to silence while he worked. Used to explaining only outcomes.
„Then we must go slowly,“ he said.
Liina smiled faintly. „I collect stories. I am patient.“
She laid out a page of markings. Simple unary strokes, separated into short groups. Some groups appeared again, unchanged.
„These are refrains,“ she said. „Copied faithfully. Over and over. When I count them like this, repetition begins to look like importance.“
Mihkel nodded. „And you suspect that sameness is distorting the picture.“
„Yes,“ Liina replied. „I want to see each distinct voice once. No more.“
Mihkel drew the tape closer. „Then the task is not to count, but to recognise.“
He uncovered the Logic Mill just enough for its levers to be visible. Liina did not lean closer. She watched his hands instead.
„The Mill cannot remember everything,“ Mihkel said. „But it can compare what it sees now to what it has already passed.“
He pointed to the tape. „Each group is read. Then the Mill searches the earlier tape. If it finds the same group, exactly the same, it erases the later one.“
„And if there is the smallest difference?“ Liina asked.
„Then it stays,“ Mihkel replied. „The Mill does not interpret. It only refuses to repeat certainty.“
Liina considered this. „So it forgets without judgement.“
„Yes,“ Mihkel said. „Which is why the rules must be strict. Otherwise forgetting becomes opinion.“
Together, they fed the tape into the machine. The Logic Mill began to move, steady and deliberate. When it encountered repetition, it hesitated—then acted. The sound was small. Almost polite. Liina watched every motion. She did not interrupt.
At last, the Mill stopped.
On the input tape, you’ll get numbers in the unary format separated by commas. Your task is to remove all duplicates, leaving only the first occurrence of each number.
The numbers are in range from 1 to 20. The input list contains between 1 and 30 numbers in total.
For example, if the input tape is
|,||,||,|||,|,
your output tape should be
|,||,|||.