
Thank you so much ! Luca and Bastian !
Now, I can handle whole text file as one list.
I want to do this... extract one text, or eliminate one text(like "tail
LIST") etc...
Thank you.
Also very Thankful to Bastian.
I'll try readFile function.
Thank you again, and Have a nice day.
Sincerely, Sok Chang
2010/12/14 Luca Toscano
On 12/14/2010 12:32 PM, Sok H. Chang wrote:
Thank you so much, Luca. Mmm... I want to make a "List of Sentence" from some text file.
inputFile.txt is like this. -------------------------------- This is a pen. Is this a pen? etc...many sentence. Each line, only one sentence.
How can I make a list of sentence? How can I declared inpStr?
Thank you.
Sincerely, Sok Chang
You're welcome! I am a beginner in haskell programming, it's interesting to work with others! By the way, this is the code:
import System.IO import System.Random import Data.List
main :: IO () main = do inh <- openFile "path_to_file" ReadMode prova <- (mainloop inh []) print prova hClose inh
mainloop :: Handle -> [String] -> IO [String] mainloop inh list = do
ineof <- hIsEOF inh if ineof then return list
else do inpStr <- hGetLine inh mainloop inh (list ++ [inpStr])
This is my version, it works I think.. I hope this helps you!!
Luca
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
-- Sok Ha, CHANG Open Mind Clinic/Academy, 1551-1, Sa-Dong, SangRok-Gu, AnSan-City, KyongGi-Do Tel: 031-407-6114 HP: openmind.ac / www.openmind.ac