Talk:Longest string challenge: Difference between revisions

Line 103:
::::::: Also, for reference, here is a "use length directly" approach: <code>(#~ (=>./)@:(#@>))@(<;._2)@(1!:1)</code> and note that it does not use any "comparison operators" except = and that it's not doing any "arithmetic". It is, however, finding the maximum length and using that to select the relevant rows.
::::::: --[[User:Rdm|Rdm]] 01:08, 15 August 2011 (UTC)
:::::::: Oh, I knew that this (adapting the task) was going to hurt :) And I get that J thinking tends to be outside the box, which is why I'd be very disappointed if we could not find a way to fit this task to J. It's really a question of how to respecify it.
:::::::: From what I've seen in Icon on the TWiki and in some of the submissions here, just avoiding comparing lengths directly via lt/gt pretty much satisfies. The Icon solutions, C, python, are using techniques that detect end of string indirectly. They don't so much find the maximum length as creep up on it - detecting that one more character exists the two posted Icon solutions do this through string scanning move consumes characters in the current string and by testing for the existence of the i-th character of a string. The avoidance of lists was just to find another way of accumulating the results instead of the easy reset the list of strings each time we see a longer list. Solutions involve using recursion or just a long string as an accumulator work well.
:::::::: I'm barely following your explanations (not your fault at all). Do you mean no boxed strings (does that even make sense)? As for the first explanation, if we have 'ab' and 'abc' you will be matching 'ab ' & 'abc' vs. ' ba' & 'abc'. Not directly using length. The C example (cmp) is another example of indirect pointer incrementing and using equality testing for the end of string. I think the C example passes the intent. --[[User:Dgamey|Dgamey]] 03:59, 15 August 2011 (UTC)
 
== Not pointless ==
Anonymous user