in reply to Re: Pivoting 2 dimensional array refs
in thread Transposing 2 dimensional arrays
I would normally, in any language, spot that construct:
as something to be folded up into one expression. Perhaps a terinary operator: value = (something) ? xxxxx : yyyy. But the "defined or" really shines here, reeling in the rest. That is precisely the idiom that the OP needs in the problem: grab the value at the source coordinates, but make it '' instead of undef.if (something) value = xxxxx else value = yyyy
I see that the computation of max_col was made into one line by using the suffix form of 'for'. That shrunk the vertical expanse of code down quite a bit.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Pivoting 2 dimensional array refs
by Voronich (Hermit) on May 14, 2011 at 14:11 UTC | |
by John M. Dlugosz (Monsignor) on May 14, 2011 at 15:43 UTC | |
by Voronich (Hermit) on May 18, 2011 at 15:32 UTC | |
by John M. Dlugosz (Monsignor) on May 18, 2011 at 19:02 UTC | |
by BrowserUk (Patriarch) on May 14, 2011 at 14:24 UTC | |
by Voronich (Hermit) on May 14, 2011 at 16:41 UTC | |
by Anonymous Monk on May 14, 2011 at 14:31 UTC |