This is dumb
This commit is contained in:
parent
397a741931
commit
88e595e5f9
12
app/9.hs
12
app/9.hs
@ -37,9 +37,15 @@ fit s t = let (p,a) = break (elem None) s
|
|||||||
concat p ++ if length (head n) >= length t then t ++ replicate (length n) None ++ concat a' else concat n ++ fit a' t
|
concat p ++ if length (head n) >= length t then t ++ replicate (length n) None ++ concat a' else concat n ++ fit a' t
|
||||||
|
|
||||||
sort2 :: [ℜ] -> [ℜ]
|
sort2 :: [ℜ] -> [ℜ]
|
||||||
sort2 s = let c = chunks s -- TODO: needs more work here
|
sort2 s = let c = chunks s in
|
||||||
fitted = fit (init c) (last c) in
|
if notElem None $ last c
|
||||||
if s == fitted then s else sort2 s
|
then let fitted = fit (init c) (last c) in
|
||||||
|
if s == fitted then head c ++ case c of
|
||||||
|
[] -> []
|
||||||
|
[c] -> c
|
||||||
|
c@[_,_] -> concat c
|
||||||
|
c -> sort2 (concat . tail $ init c) ++ last c else sort2 fitted
|
||||||
|
else sort2 (concat $ init c) ++ last c
|
||||||
|
|
||||||
solve :: ([ℜ] -> [ℜ]) -> [ℜ] -> Int
|
solve :: ([ℜ] -> [ℜ]) -> [ℜ] -> Int
|
||||||
solve f s = let fixed = (\case
|
solve f s = let fixed = (\case
|
||||||
|
Loading…
Reference in New Issue
Block a user