Would this function benefit from functional programming?

WhatMeWorry` kheaser at gmail.com
Thu Nov 21 00:34:50 UTC 2024


I use this pattern very frequently throughout my code

```
void displayHex()
{
     foreach(r; 0..rows)
     {
         foreach(c; 0..columns)
         {
             writeln("...");
             foreach(p; 0..6)
             {
                 writeln("...");
             }
         }
     }
}
```
And I was wondering if it would be worthwhile to convert it to 
functional programming. I saw a talk by Mr. Bright who did 
something like, a.c.d(3).e.f

But his example was understandably terse.  I believe the map 
function can take the place of the foreaches?  Also I've been 
unable to find examples of writeln being used.  I'm not 
interested in speeding up the code or making it more 
understandable. Just making it more compact.  Maybe what I'm 
really asking is if functional programming is not appropriate in 
all scenarios.


More information about the Digitalmars-d-learn mailing list