Talk:Longest common prefix: Difference between revisions

→‎No strings case: The empty set
(→‎No strings case: The empty set)
 
(7 intermediate revisions by 5 users not shown)
Line 1:
== explaining the maths equations ==
Please explain the maths equation for an audience of programmers rather than mathematicians, thanks. --[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 15:00, 19 March 2015 (UTC)
 
Line 12 ⟶ 13:
 
: Therefore: it's not reasonable to suppose that this prefix should be useful for the recursive case. --[[User:Rdm|Rdm]] ([[User talk:Rdm|talk]]) 02:57, 21 March 2015 (UTC)
 
I think the first '''AppleScript''' example (which uses ObjC libraries) may express a slight misapprehension here. The empty list case appears to have been interpreted as a dynamically typed case in which the function is applied to the integer value zero. [[User:Hout|Hout]] ([[User talk:Hout|talk]]) 16:36, 8 April 2020 (UTC)
 
: Are you saying that the zero means an empty list in some language? There's an "empty ''set''" character which looks similar to it when rendered in the "STIXVariants" font in Mojave. The handler response is the same in either case: no strings, so return "". But I'll edit the input in the posted test code. Thanks. --[[User:Nig|Nig]] ([[User talk:Nig|talk]]) 17:57, 8 April 2020 (UTC)
 
:: Exactly – a standard mathematical symbol for the empty set. The problem is essentially framed in terms of sets (word sequence doesn't matter here), for which lists are a serviceable proxy in this case, particularly in languages which don't directly support set operations, but do natively provide some kind of vector, list or array [[User:Hout|Hout]] ([[User talk:Hout|talk]]) 18:43, 8 April 2020 (UTC)
 
==Python: Use of an error==
Line 23 ⟶ 30:
 
:That result should be the empty string. --[[User:Rdm|Rdm]] ([[User talk:Rdm|talk]]) 21:53, 24 March 2015 (UTC)
 
::Could you pls add this case to the task description!?! --[[User:Walterpachl|Walterpachl]] ([[User talk:Walterpachl|talk]]) 07:15, 25 March 2015 (UTC)
 
:::You could do that yourself. Just change the task description and add [[Template:Update]] to the existing implementations. (Note that this isn't my task - I was only answering based on the definition of the task. It should be pretty clear that the longest common prefix for a set of strings which includes the empty string has to be the empty string, because the empty string is the only valid prefix for the empty string...) --[[User:Rdm|Rdm]] ([[User talk:Rdm|talk]]) 07:38, 25 March 2015 (UTC)
 
::::I'll leave that to the task's author. Thanks for the clarification --[[User:Walterpachl|Walterpachl]] ([[User talk:Walterpachl|talk]]) 08:24, 25 March 2015 (UTC)
9,655

edits