ZshZsh -y
, 412 383 bytes
for x y (first two-turtle-doves second three-french-hens third `for a b (four call\ -birds five golden-r\ s six geese-a-lay seven swans-a-swimm eight maids-a-milk nine ladies-danc ten lords-a-leap eleven pipers-pip twelve drummers-drumm)()(<<<$a-$1ing$2\ ${${a%[et]}/%v/f}th) $b`)<<<"On the $x day of Christmas my true love gave to me $1a partridge in a pear tree "&&1="$y ${1-and- }"
Attempt This Online!Attempt This Online!
This may be the first time I've used Zsh's anonymous functions in golf. By combining it with the -y
option, I can conveniently split $b
into $1
and $2
.
Makes use of some interesting symmetries:
- all the gifts (starting with the fourth) contain
ing
- five -> fifth; twelve -> twelfth (that's a mini-etymology lesson for you)
- nine -> ninth; eight -> eighth