I'm still new to haskell, so please excuse my bad code style.
I need all kinds of letter combinations in a box written to a file. In fact, I need all these lines to make a brutal attack on the old riddle of the riddle. The line consists of 26 letters and 10 numbers. The puzzle indicates that the first 6 characters were letters.
Now this is my code:
import Data.List (delete) letters = ['A'..'Z'] allChars = letters ++ ['0'..'9'] boxContents :: [Char] -> [Char] -> [[Char]] boxContents l lp = [a:b:c:d:e:f:delete f(delete e(delete d(delete c (delete b (delete a lp))))) | a <- l, b <- delete al, c <- delete b (delete al), d <- delete c (delete b (delete al)), e <- delete d (delete c (delete b (delete al))), f <- delete e (delete d (delete c (delete b (delete al)))) ] main :: IO() main = writeFile "c:\\bc.txt" $ unlines $ boxContents letters allChars
He eats up my 16GB plunger and consumes a 100GB swap file until he dies. I'm sure I can write a simple program in plain old C that uses less than 64 KB of RAM to create this file. But this is not the main thing: the point is how to make this work in Haskell? Where is my mistake?
source share