Previous: Replace, Up: Reference Implementations


B.4 Transition

This code is relevant to the discussion of transfer in Transfer, where its specification is described in detail. When this code is evaluated on a virtual code application f, the result is the code for a transition function that takes one configuration to the next in the course of evaluating a transfer function, as specified in equations E7 to E9.

     
     output_buffer = compose(left,argument)
     input_buffer = compose(right,compose(right,argument))
     active = compose(left,compose(right,argument))
     state = compose(left,active)
     output = compose(right,active)
     
     transition =
     
     bu(compose,refer) (hired bu(conditional,active))(
        (hired conditional)(
           constant input_buffer,
           bu(compose,(fan bu(hired meta,self))) (hired apply)(
              constant fan bu(couple,couple(output,output_buffer)),
              couple (fan bu(compose,couple))(
                 couple(
                    (hired apply)(
                       hired,
                       constant (state,compose(head,input_buffer))),
                    constant compose(tail,input_buffer)),
                 couple(
                    (hired apply)(hired,constant(state,constant nil)),
                    constant constant nil)))),
        constant compose(flat,compose(reverse,output_buffer)))