( FFA Ch 4 Puzzle: Write a FFACalc tape that will take seven numbers, presumed to be on the top of the stack, and return the largest. For instance, suppose file numbers.txt were to contain: .9.1.7.5.1.1.0 Then the following example invocation: cat numbers.txt youranswer.txt | ./bin/ffa_calc 256 16 ... should produce the output: 0000000000000000000000000000000000000000000000000000000000000009 ) ( Assume for now that the top of the stack is the largest number. Since we don't have loops, we just have an op that we repeat seven - 1 times. The op is, on a high-level view: compare the current two topmost elements on the stack and keep the higher of the two. However, < and > destroy both operands, whereas we want to destroy only the lower of them. So first, we duplicate both operands, using 'over'; then we compare and conditionally keep the higher of the two, a la: ) ``<{'_}{_}_ ( Note that '<' is Stack(SP - 1) < Stack(SP); thus, if the topmost word is higher, we swap the two words and drop; else we just drop. Either way, the lowest of the two is derped. ) ( Now we just repeat this five more times (six comparisons in total). ) ``<{'_}{_}_ ``<{'_}{_}_ ``<{'_}{_}_ ``<{'_}{_}_ ``<{'_}{_}_ ( And we print. ) #