tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 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
|
||||
4
Task/Set-consolidation/Ela/set-consolidation-2.ela
Normal file
4
Task/Set-consolidation/Ela/set-consolidation-2.ela
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
open console
|
||||
|
||||
consolidate [['H','I','K'], ['A','B'], ['C','D'], ['D','B'], ['F','G','H']] |> writen $
|
||||
consolidate [['A','B'], ['B','D']] |> writen
|
||||
Loading…
Add table
Add a link
Reference in a new issue