Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
11
Task/Set-consolidation/Ela/set-consolidation-1.ela
Normal file
11
Task/Set-consolidation/Ela/set-consolidation-1.ela
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
open list
|
||||
|
||||
merge [] ys = ys
|
||||
merge (x::xs) ys | x `elem` ys = merge xs ys
|
||||
| else = merge xs (x::ys)
|
||||
|
||||
consolidate (_::[])@xs = xs
|
||||
consolidate (x::xs) = conso [x] (consolidate xs)
|
||||
where conso xs [] = xs
|
||||
conso (x::xs)@r (y::ys) | intersect x y <> [] = conso ((merge x y)::xs) ys
|
||||
| else = conso (r ++ [y]) ys
|
||||
9
Task/Set-consolidation/Ela/set-consolidation-2.ela
Normal file
9
Task/Set-consolidation/Ela/set-consolidation-2.ela
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
open monad io
|
||||
|
||||
:::IO
|
||||
|
||||
do
|
||||
x <- return $ consolidate [['H','I','K'], ['A','B'], ['C','D'], ['D','B'], ['F','G','H']]
|
||||
putLn x
|
||||
y <- return $ consolidate [['A','B'], ['B','D']]
|
||||
putLn y
|
||||
Loading…
Add table
Add a link
Reference in a new issue