OdeToCode IC Logo

Trouble, Trouble, A Quintuple of Double

Tuesday, June 26, 2012
Func<double, double, double, double, double> distance = 
(x1, y1, x2, y2) =>
Math.Sqrt(Math.Pow(x2 - x1, 2) + Math.Pow(y2 - y1, 2));

A lady once asked me if this code was perfectible
if the Quintuple Of Double was somehow susceptible
to replacing with code still likeminded yet loveable
for the Quintuple Of Double offered feelings of trouble.

delegate double TwoPointOperation(double x1, double y1, 
double x2, double y2);

TwoPointOperation distance =
(x1, x2, y1, y2) =>
Math.Sqrt(Math.Pow(x2 - x1, 2) + Math.Pow(y2 - y1, 2));
I told her the code was still quite correctable 
a delegate type would make her worries reversible
and the one thing worse than a Quintuple Of Double
is the Sextuplet Of Object, then you know you’re in trouble.