Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
15
Task/Rep-string/Miranda/rep-string.miranda
Normal file
15
Task/Rep-string/Miranda/rep-string.miranda
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
main :: [sys_message]
|
||||
main = [Stdout (lay (map test tests))]
|
||||
|
||||
test :: [char]->[char]
|
||||
test s = s ++ ": " ++ show (repstrings s)
|
||||
|
||||
tests :: [[char]]
|
||||
tests = ["1001110011", "1110111011", "0010010010", "1010101010",
|
||||
"1111111111", "0100101101", "0100100", "101", "11", "00",
|
||||
"1"]
|
||||
|
||||
repstrings :: [*]->[[*]]
|
||||
repstrings s = filter matching bases
|
||||
where bases = [take n s | n<-[1..#s div 2]]
|
||||
matching r = s = take (#s) (concat (repeat r))
|
||||
Loading…
Add table
Add a link
Reference in a new issue