Talk:Floyd's triangle: Difference between revisions

From Rosetta Code
Content added Content deleted
(→‎Output: comment on the task's 2nd requirement (alignment of numbers and only one blank between numbers on a line). -- ~~~~)
(→‎Output: Can be done)
Line 18: Line 18:


::: The last requirement (2nd requirement) --- ''that only one space separates numbers of the last row'' --- this is an incorrect (impossible) requirement as the last line may have different width (length) numbers and some may have one blank, others will have two blanks, and that would preclude the numbers lining up as shown in the example. Case in point would be for a four or fifteen-row Floyd's triangle. If this assumption isn't correct, then the author has to change line four of the example to match their own requirement. For now, I'm programming the 2nd REXX version as it is shown in the example (''The first few lines of a Floyd triangle looks like this''), and that's what the programming example does (and displays), and what almost all examples have shown. -- [[User:Gerard Schildberger|Gerard Schildberger]] 03:33, 17 July 2012 (UTC)
::: The last requirement (2nd requirement) --- ''that only one space separates numbers of the last row'' --- this is an incorrect (impossible) requirement as the last line may have different width (length) numbers and some may have one blank, others will have two blanks, and that would preclude the numbers lining up as shown in the example. Case in point would be for a four or fifteen-row Floyd's triangle. If this assumption isn't correct, then the author has to change line four of the example to match their own requirement. For now, I'm programming the 2nd REXX version as it is shown in the example (''The first few lines of a Floyd triangle looks like this''), and that's what the programming example does (and displays), and what almost all examples have shown. -- [[User:Gerard Schildberger|Gerard Schildberger]] 03:33, 17 July 2012 (UTC)

::::Hi Gerard,
::::* First arrange that the columns are of such a width that all the numbers of the last row are separated by one space only.
::::* Then ensure that each column of numbers is packed to the right of its column width.
:::: Et voilà! --[[User:Paddy3118|Paddy3118]] 06:58, 17 July 2012 (UTC)

Revision as of 06:58, 17 July 2012

Inspiration

I need to add a link to Vihart.

Can the colour of the font of just the task description be changed to pink? (A Dark side of the moon joke). --Paddy3118 19:13, 24 June 2012 (UTC)

Output

  • Has to be shown
  • Has to be formatted just-so.
    --Paddy3118 19:17, 24 June 2012 (UTC)

I am changing the output from print n=5 and n=15 to n=5 and n=14 to highlight the case of what should be done when the number of digits in the numbers of the last row changes, and is not the last digit itself. In this case, column widths need to change. Sorry Go language (but thanks for the quick example). The reason is, that I am trying to be more rigourous about the output format than in Pascal's triangle. --Paddy3118 06:52, 25 June 2012 (UTC)

The current format requirement may be rigorous, but not intuitive. You go through all this trouble to align digits, yet because widths of numbers vary within each line, the slanted right edge of the triangle is not a straight line and looks unpleasant. What's the point of the complicated formatting, really? --Ledrug 23:03, 25 June 2012 (UTC)
Partially a reaction to the issues seen in Pascal's triangle where there was not enough rigor. No doubt someone could still find a way to adhere to the letter of the task rather than the spirit, but that too could be interesting to see. (I pity the people that have to write documentation for their work who don't try doing something similar for an open source type project where lessons learned can be rapid and sometimes brutal, but on RC - kind-a nice).
Partially because some specs are just as particular; with non-intuitive requirements that are even more hidden. --Paddy3118 02:07, 26 June 2012 (UTC)
P.S. Should I add an optional goal: to add an option to your routine that can produce equi-width columns ? --Paddy3118 02:07, 26 June 2012 (UTC)
The last requirement (2nd requirement) --- that only one space separates numbers of the last row --- this is an incorrect (impossible) requirement as the last line may have different width (length) numbers and some may have one blank, others will have two blanks, and that would preclude the numbers lining up as shown in the example. Case in point would be for a four or fifteen-row Floyd's triangle. If this assumption isn't correct, then the author has to change line four of the example to match their own requirement. For now, I'm programming the 2nd REXX version as it is shown in the example (The first few lines of a Floyd triangle looks like this), and that's what the programming example does (and displays), and what almost all examples have shown. -- Gerard Schildberger 03:33, 17 July 2012 (UTC)
Hi Gerard,
  • First arrange that the columns are of such a width that all the numbers of the last row are separated by one space only.
  • Then ensure that each column of numbers is packed to the right of its column width.
Et voilà! --Paddy3118 06:58, 17 July 2012 (UTC)