Talk:Ordered words

From Rosetta Code

Lexicographical order

Note: This task should probably be modified to be aware (and tolerant) of lexicographical order. --Michael Mol 22:15, 9 November 2010 (UTC)

I think it's probably not important on that particular dictionary; it's all lower case and well-behaved. –Donal Fellows 22:37, 9 November 2010 (UTC)
Yes, I thought I had programmed (REXX) for an unlexicographical ordered dictionary, but it erronously gave me the correct result (because the list of words was in order). Yes, that does sound strange. The program has been fixed. -- Gerard Schildberger 06:28, 14 July 2012 (UTC)

longest word length

By "longest word length", do you mean "equal to the length of the longest ordered word"? --Michael Mol 22:16, 9 November 2010 (UTC)

Yes. I find the ordered words, find the maximum length of any ordered word, then find all ordered words of that maximum length. --Paddy3118 13:09, 10 November 2010 (UTC)
For contrast, the Tcl code does it in a single pass. (It happened to be more natural to express it that way.) The result is the same though; the words in the result list are such that they are all of the same length, all ordered words, and there is no other ordered word (in the originating dictionary) such that its length is greater than the length of any result word. (Also, every ordered word of that length in the originating dictionary is present in the result.) I can't be bothered to write that mathematically. :-) –Donal Fellows 16:24, 10 November 2010 (UTC)

Knotty problem

I noticed three of the examples written by User talk:Ulrie, C++, Perl and Perl 6; don't have the word knotty mentioned. I don't know if this is due to a faulty copy of the dictionary or a faulty algorithm. (Knotty is still in the dictionary). I will give it a day then I think I should mark them incorrect? --Paddy3118 12:05, 27 November 2010 (UTC)

Or could their algorithms not cope with the double-t in knotty? (But note, The task description does state that the word 'abbey' with a double-b is to be considered ordered. --Paddy3118 16:58, 27 November 2010 (UTC)
Is there a public-domain (or, GFDL1.2-compatible, at least) wordlist I could host and have dictionary-dependent tasks draw from? URL preferred; Places I'm looking have weird or tricky copyright restricitons. --Michael Mol 18:18, 27 November 2010 (UTC)
This? --Paddy3118 06:02, 28 November 2010 (UTC)
In the Perl code it was a faulty algorithm that hardwired the number of expected results!?! I fixed the Perl and Perl 6, but someone else can fix the C++. --TimToady 18:32, 27 November 2010 (UTC)
Thanks TimToady. --Paddy3118 05:42, 28 November 2010 (UTC)

Output

Generally, tasks which are about writing programs (not describing language features) make requirements of the program’s output, not the form of the example itself. If it is required the output of the program to be included in the example,

  • then please clarify the task wording.
  • why is it required?

A few output examples are useful in checking one's own work when adding implementations, but it seems silly to insist that every single program come with its output. I would like to understand the motivation here. —Kevin Reid 18:36, 1 February 2011 (UTC)

Hi Kevin, on other occasions, having output available has helped find and debug problems where output has been given and it was easier to spot something missing from the output and then look more closely at the implementation. I, and others do try and not insist on output if output will always be large. An easy case for insisting on output is something like Conway's Game of Life were output (of some sort) has been given. Come to think of it, it was Wireworld where odd output lead to fixing of an example.
In other cases it aids consistency. If output is needed from one, to allow others to complete the task, then asking for output from all is consistent. The requst for output in this task should be straight-forward to do.
Different tasks get patrolled and "policed" to different degrees, but I'm sure their is no underlying malice to a request to add output. --Paddy3118 19:03, 1 February 2011 (UTC)

E and Factor

Someone marked the E and Factor examples as incomplete/incorrect because they print no output. Yet both examples seem to have print statements (println(" ".rjoin(best.snapshot())) or filter-longest-words [ print ] each. Did someone add the print statements and forget to remove the incomplete/incorrect marks? --Kernigh 20:45, 9 March 2011 (UTC)

If you compare those to others you should see that the output of those programs are not given, even though the task asks for it. One might argue that running the programs would give the display, but a quick reading of other examples should show that the output is required in addition to the program source. --Paddy3118 21:06, 9 March 2011 (UTC)

Not sure about E, but I installed Factor and confirmed that the Factor example really outputs the answer. The task asks for the program to "display" the answer, but the task does not require anyone to post the answer on this page. --Kernigh 23:18, 9 March 2011 (UTC)

Hi Kernigh, you seem to be ignoring both comments and the other examples - most of which give their output on the task page. (not this talk page), ... ...How should the task page be altered to ensure most people put the results on the page? Most of the current results comply; the task states that it should be displayed and displaying it elsewhere would not be of much help. --Paddy3118 00:25, 10 March 2011 (UTC)

I am guessing that the program would display it on standard output, or in a GUI window, or something like that. That would allow the person who runs the program to see the answer. Or am I misunderstanding? --Kernigh 01:09, 10 March 2011 (UTC)

We want it shown on this page. Just copy the output and paste it in a pre block under the example. --Mwn3d 01:34, 10 March 2011 (UTC)
I don't think that the 'on this page' comment is needed in the task description; most people would imply that. --Paddy3118 17:49, 10 March 2011 (UTC)

Now that we fixed the task description, I agree that the output must be on the page. As of now, every example on the page has output on the page, except for E. Can someone run the E program and post the output? --Kernigh 02:24, 11 March 2011 (UTC)


I suggest to change the last two lines of the Rexx program to <lang rexx> say words(i.m) 'words found (of length' m")"; say /*show & tell time*/

 do n=1 for words(i.m);  say word(i.m,n);  end       /*list the words. */

</lang> I added abcdefgh to the unixdict.txt and got 0 words of length 8. And please add to i.= for compatibility.

--Walterpachl 18:26, 13 July 2012 (UTC)

Well, yes, you used the wrong index. If I changed the code to what you want, the REXX program will no longer work correctly nor solve the task at hand. -- Gerard Schildberger 21:18, 13 July 2012 (UTC)
And also, these comments shouldn't be placed under the E and Factor section. -- Gerard Schildberger 21:18, 13 July 2012 (UTC)
Also, note that this program entry was entered for classic REXX, and is not meant for other object-oriented languages. -- Gerard Schildberger 21:18, 13 July 2012 (UTC)

A bug in Rexx solution

Please try your program with this test file:

abcdef
abcde
abcd  

Expected result: 1 word of length 5.

My expectation is: 1 words of length 6. [I didn't think it would be necessary to add a pluralizer to this program, but in hindsight, I should have.] -- Gerard Schildberger 06:42, 14 July 2012 (UTC)

Suggested code change under wrong section. sorry.

"and is not meant for other object-oriented languages"
How can a program be meant to be...
When corrected as shown above it runs perfectly well with ooRexx

--Walterpachl 05:34, 14 July 2012 (UTC)

I do not have an ooREXX (other than ROO!) available to check whether it runs under an object-oriented language (nor do I have an interest of doing so as I have often repeated), so I can't answer your query regarding ooRexx. -- Gerard Schildberger 06:42, 14 July 2012 (UTC)

Looking at the program again I noticed two typos EBCDICI should be EBCDIC and then should be than (2 places) I dare not change your program.

I had programmed the REXX example to expect a lexicographical ordered word list. I corrected the error. -- Gerard Schildberger 06:42, 14 July 2012 (UTC)
Thank you
You don't have to have ooRexx. You COULD write i.= instead of i.= to avoid the incompatibility
(and the use of $#@ in symbols - which aren't used in this program)
and you didn't correct the 'thens' (is less then -> is less than) :-(

--Walterpachl 07:49, 14 July 2012 (UTC)