Parametric Polymorphism
type variables


Task

Write a small example for a type declaration that is parametric over another type, together with a short bit of code (and its type signature) that uses it.



A good example is a container type, let's say a binary tree, together with some function that traverses the tree, say, a map-function that operates on every element of the tree.

This language feature only applies to statically-typed languages.




Polymorphism is a room.
 
To find (V - K) in (L - list of values of kind K):
	repeat with N running from 1 to the number of entries in L:
		if entry N in L is V:
			say "Found [V] at entry [N] in [L].";
			stop;
	say "Did not find [V] in [L]."
 
When play begins:
	find "needle" in {"parrot", "needle", "rutabaga"};
	find 6 in {2, 3, 4};
	end the story.