The first written reference dates from the beginning of the 12th century, when it was not a therapeutic advice, but a story so that whoever listened to it fell asleep. In the book Discipline clericalis, the Spanish Jew Pedro Alfonso de Huesca (Moseh Sefardí) compiled, among other stories, that of a king who has a fabulist at his service, who invents five stories every night to make him fall asleep.
As he suffers from insomnia, the monarch demands a longer story each time, so that the narrator comes up with that of a villager who buys two thousand sheep and, when he takes them back home, has to ford a river. But it only has a small boat that can hold two specimens at the same time. The narrator enumerates each of the animals' movements, and, as there are so many, the king falls into the arms of Morpheus before the end of the ford.
The work of Pedro Alfonso de Huesca, written in Latin, included thirty-three exemplary stories from Christian, Jewish and Muslim oral sources, and was widely disseminated in Europe, where he introduced oriental short stories, which would have a strong influence on western literature.
A proof of its success is that this story of the sheep passed to Italy and other places within the genre of bedtime stories. Cervantes pays homage to this type of narration without ending when Sancho explains a similar episode to Don Quixote, but with goats instead of sheep.





