Talk:Set consolidation: Difference between revisions

→‎Haskell: Output is ok
(→‎Why.: "Connected components of a graph". Yah!)
(→‎Haskell: Output is ok)
 
(7 intermediate revisions by 4 users not shown)
Line 11:
 
::Hi Ledrug, I wasn't sure of a general need either so left out mentioning order independence from the main task description but just wanted to make sure of my Python code so reported the run of it in the Python docstring. --[[User:Paddy3118|Paddy3118]] 01:13, 8 May 2012 (UTC)
 
::: Also task doesn't make clear what should happen when input contains empty sets. Consider this:<lang python>def conso(s):
if len(s) < 2: return s
 
r, b = [s[0]], conso(s[1:])
for x in b:
if r[0].intersection(x): r[0].update(x)
else: r.append(x)
return r
 
print(conso([{1, 2}, set([]), set([])]))</lang> Is that what you want? --[[User:Ledrug|Ledrug]] 01:44, 8 May 2012 (UTC)
 
:::: Cool a recursive version. Maybe you could add it as a second Python implementation? Maybe I need to add that you should return your input when asked to consolidate less than two sets; as you have done. --[[User:Paddy3118|Paddy3118]] 10:54, 8 May 2012 (UTC)
 
== Sets of Sets ==
 
This task specifies an intermediate result which can be a set or which can be a set of sets. But this can become ambiguous if the input is a set of sets of sets. I think it would be better if the task stuck with one level of abstraction for intermediate results (if arguments and all intermediate results were a set of sets). --[[User:Rdm|Rdm]] 22:35, 30 June 2012 (UTC)
 
:Hi Rdm, think of the intermediate as being consistently a set of set'''s''' where the number of set'''s''' can equal one; or more. --[[User:Paddy3118|Paddy3118]] 07:17, 1 July 2012 (UTC)
 
:: I did :) --[[User:Rdm|Rdm]] 17:17, 1 July 2012 (UTC)
 
== Haskell ==
Is the Haskell version producing the right output for example 4?
--[[User:Soegaard|Soegaard]] ([[User talk:Soegaard|talk]]) 18:05, 17 May 2013 (UTC)
 
:Without any output, I cannot tell. --[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 19:14, 17 May 2013 (UTC)
 
:The output looks fine to me. --[[User:AndiPersti|Andreas Perstinger]] ([[User talk:AndiPersti|talk]]) 17:07, 2 March 2014 (UTC)