# Functions (solution)

## by Kai Huang

The solver needs to figure out what each function does, and then evaluate the final long expression to get the answer.

The functions always take English words as inputs and always output English words as well. Non-words are never allowed during the computations. Sometimes, a function has more than one valid output based on its definition, in which case the solver must choose the appropriate output based on the surrounding context. The functions are as follows:

Function Summary name Description
a(x) shiftWrap Positionally shifts the letters of x by some amount to make a different word (letters shifted off one side are wrapped around to the other side).
b(x) takeEveryOther Takes either the odd- or even-position letters of x to form a word.
c(x) getNext Gets the next item after x in some common sequence.
d(x) reverse Reverses the letters of x to form a word.
e(x, y) concatenate Concatenates x and y into a word xy.
f(x) getHomophone Gets a homophone of x.
g(x) changeGender Gets an opposite-gender version of x.
h(x) rotate Visually rotates x 180 degrees to form a word.
i(x) shiftCaesar Caesar-shifts x into a different word.
j(x, y) getLinkWord Gets a word w such that “x w” and “w y” are both common terms.
k(x) getPartner Gets a word w that is commonly associated with x in a phrase using “and”, such as “w and x”, “the w and the x”, or “an x and a w”.
l(x) getBritish Gets a British equivalent of the American word x.
m(x, y) insert Inserts x into y somewhere such that the resulting string is a word.
n(x) getAntonym Gets an antonym of x.

Here are the computations for the clue equations.

 ATE = a(b(c(d(ATE)))) = shiftWrap(takeEveryOther(getNext(reverse(ATE)))) = shiftWrap(takeEveryOther(getNext(ETA))) = shiftWrap(takeEveryOther(THETA)) = shiftWrap(TEA) = ATE BOREDOM = e(f(g(h(MOS))), i(PAY)) = concatenate(getHomophone(changeGender(rotate(MOS))), shiftCaesar(PAY)) = concatenate(getHomophone(changeGender(SOW)), DOM) = concatenate(getHomophone(BOAR), DOM) = concatenate(BORE, DOM) = BOREDOM BOWL = j(k(l(FRIES)), a(MEGA)) = getLinkWord(getPartner(getBritish(FRIES)), shiftWrap(MEGA)) = getLinkWord(getPartner(CHIPS), GAME) = getLinkWord(FISH, GAME) = BOWL ITEM = a(m(b(l(ELEVATOR)), j(BEATS, TOO))) = shiftWrap(insert(takeEveryOther(getBritish(ELEVATOR)), getLinkWord(BEATS, TOO))) = shiftWrap(insert(takeEveryOther(LIFT), ME)) = shiftWrap(insert(IT, ME)) = shiftWrap(MITE) = ITEM LOSE = n(h(d(i(SOT)))) = getAntonym(rotate(reverse(shiftCaesar(SOT)))) = getAntonym(rotate(reverse(MIN))) = getAntonym(rotate(NIM)) = getAntonym(WIN) = LOSE NOM = h(f(c(j(GROUND, m(IT, GRAVY))))) = rotate(getHomophone(getNext(getLinkWord(GROUND, insert(IT, GRAVY))))) = rotate(getHomophone(getNext(getLinkWord(GROUND, GRAVITY)))) = rotate(getHomophone(getNext(ZERO))) = rotate(getHomophone(ONE)) = rotate(WON) = NOM PETROL = l(b(e(GO, i(n(BREAK))))) = getBritish(takeEveryOther(concatenate(GO, shiftCaesar(getAntonym(BREAK))))) = getBritish(takeEveryOther(concatenate(GO, shiftCaesar(FIX)))) = getBritish(takeEveryOther(concatenate(GO, ADS))) = getBritish(takeEveryOther(GOADS)) = getBritish(GAS) = PETROL PICKS = f(b(g(k(PAUPER)))) = getHomophone(takeEveryOther(changeGender(getPartner(PAUPER)))) = getHomophone(takeEveryOther(changeGender(PRINCE))) = getHomophone(takeEveryOther(PRINCESS)) = getHomophone(PICS) = PICKS

Finally, here’s the computation for the answer expression, broken into multiple parts for easier reading.

 = i(l(c(f(i(d(b(m(b(k(NAVY)), PREP)))))))) = shiftCaesar(getBritish(getNext(getHomophone(shiftCaesar(reverse(takeEveryOther(insert(takeEveryOther(getPartner(NAVY)), PREP)))))))) = shiftCaesar(getBritish(getNext(getHomophone(shiftCaesar(reverse(takeEveryOther(insert(takeEveryOther(ARMY), PREP)))))))) = shiftCaesar(getBritish(getNext(getHomophone(shiftCaesar(reverse(takeEveryOther(insert(AM, PREP)))))))) = shiftCaesar(getBritish(getNext(getHomophone(shiftCaesar(reverse(takeEveryOther(PREAMP))))))) = shiftCaesar(getBritish(getNext(getHomophone(shiftCaesar(reverse(RAP)))))) = shiftCaesar(getBritish(getNext(getHomophone(shiftCaesar(PAR))))) = shiftCaesar(getBritish(getNext(getHomophone(WHY)))) = shiftCaesar(getBritish(getNext(WYE))) = shiftCaesar(getBritish(ZEE)) = shiftCaesar(ZED) = PUT = n(a(d(g(OGRESS)))) = getAntonym(shiftWrap(reverse(changeGender(OGRESS)))) = getAntonym(shiftWrap(reverse(OGRE))) = getAntonym(shiftWrap(ERGO)) = getAntonym(GOER) = COMER = i(a(g(h(i(g(b(e(c(b(d(MOOD))), k(LEG))))))))) = shiftCaesar(shiftWrap(changeGender(rotate(shiftCaesar(changeGender(takeEveryOther(concatenate(getNext(takeEveryOther(reverse(MOOD))), getPartner(LEG))))))))) = shiftCaesar(shiftWrap(changeGender(rotate(shiftCaesar(changeGender(takeEveryOther(concatenate(getNext(takeEveryOther(DOOM)), ARM)))))))) = shiftCaesar(shiftWrap(changeGender(rotate(shiftCaesar(changeGender(takeEveryOther(concatenate(getNext(takeEveryOther(DOOM)), ARM)))))))) = shiftCaesar(shiftWrap(changeGender(rotate(shiftCaesar(changeGender(takeEveryOther(concatenate(getNext(DO), ARM)))))))) = shiftCaesar(shiftWrap(changeGender(rotate(shiftCaesar(changeGender(takeEveryOther(concatenate(RE, ARM)))))))) = shiftCaesar(shiftWrap(changeGender(rotate(shiftCaesar(changeGender(takeEveryOther(REARM))))))) = shiftCaesar(shiftWrap(changeGender(rotate(shiftCaesar(changeGender(RAM)))))) = shiftCaesar(shiftWrap(changeGender(rotate(shiftCaesar(EWE))))) = shiftCaesar(shiftWrap(changeGender(rotate(WOW)))) = shiftCaesar(shiftWrap(changeGender(MOM))) = shiftCaesar(shiftWrap(DAD)) = shiftCaesar(ADD) = ILL = b(m(n(f(PROS)), a(SIN))) = takeEveryOther(insert(getAntonym(getHomophone(PROS)), shiftWrap(SIN))) = takeEveryOther(insert(getAntonym(PROSE), INS)) = takeEveryOther(insert(VERSE, INS)) = takeEveryOther(INVERSES) = NESS = j(m(, ), e(, )) = getLinkWord(insert(, ), concatenate(, )) = getLinkWord(insert(PUT, COMER), concatenate(ILL, NESS)) = getLinkWord(COMPUTER, ILLNESS) = TERMINAL