Results 1 
1 of
1
Swapping arguments and results of recursive functions
 In Mathematics of Program Construction, Proceedings, volume 4014 of LNCS
, 2006
"... Abstract. Many useful calculation rules, such as fusion and tupling, rely on wellstructured functions, especially in terms of inputs and outputs. For instance, fusion requires that wellproduced outputs should be connected to wellconsumed inputs, so that unnecessary intermediate data structures ca ..."
Abstract

Cited by 1 (0 self)
 Add to MetaCart
Abstract. Many useful calculation rules, such as fusion and tupling, rely on wellstructured functions, especially in terms of inputs and outputs. For instance, fusion requires that wellproduced outputs should be connected to wellconsumed inputs, so that unnecessary intermediate data structures can be eliminated. These calculation rules generally fail to work unless functions are wellstructured. In this paper, we propose a new calculation rule called IO swapping. IO swapping exchanges calltime computations (occurring in the arguments) and returntime computations (occurring in the results) of a function, while guaranteeing that the original and resulting function compute the same value. IO swapping enables us to rearrange inputs and outputs so that the existing calculation rules can be applied. We present new systematic derivations of efficient programs for detecting palindromes, and a method of higherorder removal that can be applied to defunctionalize function arguments, as two concrete applications. 1