Talk:Longest string challenge: Difference between revisions

Content added Content deleted
(→‎Intent of Restrictions: more on intent and balance of intent)
(→‎No comparisons: fixed indent)
Line 41: Line 41:
:: This would also cover built-in comparison functions like lt(a,b). Instead of "operators" it should probably read "operators/functions" or "operations" possibly with "built-in" in front. Now if you can write a comparison function that doesn't use these things, that would work. --[[User:Dgamey|Dgamey]] 12:35, 13 August 2011 (UTC)
:: This would also cover built-in comparison functions like lt(a,b). Instead of "operators" it should probably read "operators/functions" or "operations" possibly with "built-in" in front. Now if you can write a comparison function that doesn't use these things, that would work. --[[User:Dgamey|Dgamey]] 12:35, 13 August 2011 (UTC)
::: (1) Do equality operators count as comparison operators? In particular, do "pointer-equality" operators which do not even do data-structure-specific examinations count? (2) Do pattern-matching (regular expressions, structural patterns, etc.) operators count? —[[User:Kevin Reid|Kevin Reid]] 14:44, 13 August 2011 (UTC)
::: (1) Do equality operators count as comparison operators? In particular, do "pointer-equality" operators which do not even do data-structure-specific examinations count? (2) Do pattern-matching (regular expressions, structural patterns, etc.) operators count? —[[User:Kevin Reid|Kevin Reid]] 14:44, 13 August 2011 (UTC)
::: Based on the discussions below about the C cmp() function, I think the main intent was to avoid explicit less/greater than comparisons and comparisons of the contents of the data (i.e. two strings). Beyond end of string detection, I'm not sure how equality tests would help. So I think the answer to (1) is no. The question in (2) is a bit more complicated, the Icon solution (and others on the original TWiki) use the built in string scanning/pattern matching to consume length so this kind of thing was not intended to count as a comparison. A full-blown regular expression might allow other ways to solve this than by consuming length. Provided it avoided explicit comparison and math it should probably be allowed. It would have to be a built-in regexp as a regexp procedure in the source language would likely violate one or more of the restrictions. But also, because of it's portability it really isn't showing off the characteristics of the language even if reg exp is built in and is a bit of a cheat in that sense. If it were the only way to do it, then yes, but if there were other ways to do it I think the intent of the task is to see those other ways. I could see some people submitting a regexp and non regexp version to show the variety. --[[User:Dgamey|Dgamey]] 06:00, 14 August 2011 (UTC)
:::: Based on the discussions below about the C cmp() function, I think the main intent was to avoid explicit less/greater than comparisons and comparisons of the contents of the data (i.e. two strings). Beyond end of string detection, I'm not sure how equality tests would help. So I think the answer to (1) is no. The question in (2) is a bit more complicated, the Icon solution (and others on the original TWiki) use the built in string scanning/pattern matching to consume length so this kind of thing was not intended to count as a comparison. A full-blown regular expression might allow other ways to solve this than by consuming length. Provided it avoided explicit comparison and math it should probably be allowed. It would have to be a built-in regexp as a regexp procedure in the source language would likely violate one or more of the restrictions. But also, because of it's portability it really isn't showing off the characteristics of the language even if reg exp is built in and is a bit of a cheat in that sense. If it were the only way to do it, then yes, but if there were other ways to do it I think the intent of the task is to see those other ways. I could see some people submitting a regexp and non regexp version to show the variety. --[[User:Dgamey|Dgamey]] 06:00, 14 August 2011 (UTC)


=== No arithmetic operations ===
=== No arithmetic operations ===