Science  People  Locations  Timeline
Index: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Home > Man or boy test


 

The Man or boy test was proposed by computer scientist Donald Knuth as a means of evaluating implementations of the ALGOL programming language.

The aim of the test was to separate compilers that correctly implemented scoping and call by name (the "men") from those that did not (the "boys").

begin real procedure A(k, x1, x2, x3, x4, x5); value k; integer k; begin real procedure B; begin k := k - 1; B := A := A(k, B, x1, x2, x3, x4) end; if k <= 0 then A := x4 + x5 else B end; end; outreal(A(10, 1, -1, -1, 1, 0));

This creates a tree of B call frames that refer to each other and to the containing A call frames, each of which has its own copy of k that changes every time the associated B is called. Trying to work it through on paper is probably fruitless, but the correct answer is -67.

External links

Computer science

Read more »

Non User