prefix([1,2], [1,2,3,4])
= (1 == 1) and prefix([2], [2,3,4])
= true and prefix([2], [2,3,4])
= true and ((2 == 2) and prefix([], [3,4]))
= true and (true and (prefix([], [3,4])))
= true and (true and true)
= true and true
= true
Note: This function uses the boolean 'and' operator, which is often implemented as a conditional expression: A and B is the same as cond(A, B, false) (or, written in Cinnameg, If A then B else false %If). The significance of this is that evaluation of 'and' expressions is not done inside-out. If a conditional 'and' expression is used, then evaluation of prefix([1,2], [1,2,3,4]) is as follows.
prefix([1,2], [1,2,3,4])
= (1 == 1) and prefix([2], [2,3,4])
= true and prefix([2], [2,3,4])
= prefix([2], [2,3,4])
= (2 == 2) and prefix([], [3,4])
= true and prefix([], [3,4])
= prefix([], [3,4])
= true
Notice that (true and A) is replaced by A in this
conditional evaluation of 'and', before A is evaluated.