Slide 100
Slide 100 text
string ToRomanNumerals(int number)
{
// define a general helper function
Func replace(
string oldValue, string newValue) =>
input => input.Replace(oldValue, newValue);
// then use piping
return new string('I', number)
.Pipe(replace("IIIII","V"))
.Pipe(replace("VV","X"))
.Pipe(replace("XXXXX","L"))
.Pipe(replace("LL","C"));
}
C# example