Jensen's device
It was devised by Danish computer scientist Jørn Jensen, who worked with Peter Naur at Regnecentralen.[1][2][3] During his Turing Award speech, Naur mentions his work with Jensen on GIER ALGOL.Typically, ak will depend upon the changing (side-effected) k. For example, code to compute the sum of the first 100 terms of a real array V[] would be: During the execution of Sum, the actual argument i will increment during each step of the for loop, and each of the procedure's evaluations of ak will use the current value of i to access the successive array elements V[i].[7] A slight variation would be suitable for initiating a numerical integration of an expression by a method very similar to that of Sum.[9] Knuth says, "The use of 'macro' definition facilities to extend language, instead of relying solely on procedures for this purpose, results in a more satisfactory running program."If on the other hand the procedure were to be coded the other way around (with b being saved to temp instead of a) then the desired action would result, unless it were invoked as swap(A[i],i).