Hello Christian,
Thursday, July 07, 2005, 6:55:13 PM, you wrote:
CM> Could you also insert a prompt that is shown before the lines are read?
CM> (The first prompt seems to be tricky assuming line buffering )
import System.IO
main = do
hSetBuffering stdin LineBuffering
hSetBuffering stdout
Bulat Ziganshin wrote:
> Hello Colin,
>
> Thursday, July 07, 2005, 4:33:39 PM, you wrote:
type FilterProgram = [Line] -> [Line]
>
> CR> interact :: (String -> String) -> IO ()
>
> and there is lines and unlines functions to do just what yopu need
>
> example: main = interact (unlines.filter
Hello Colin,
Thursday, July 07, 2005, 4:33:39 PM, you wrote:
>>>type FilterProgram = [Line] -> [Line]
CR> interact :: (String -> String) -> IO ()
and there is lines and unlines functions to do just what yopu need
example: main = interact (unlines.filter(not.null).lines)
--
Best regards,
Christian Maeder wrote:
-- a filter program process an entire input to yield some output
type FilterProgram = [Line] -> [Line]
Forget this, if it's not an (old) exercise
Yes, people don't write lazy functional programs in Haskell any more.
In the Era of Monadic Enlighte
mt wrote:
> hi,
>
> i'd like to know how to write simply a line-based interactive program, that
> is
> one with which you have a 'talk'.
I would start with:
main =
do putStrLn "Please enter text (or press return to exit):"
s <- getLine
if s /= "" then do
putStrLn s
hi,
i'd like to know how to write simply a line-based interactive program, that is
one with which you have a 'talk'.
a simple filter-like line-based program ca be written as:
-- a filter program process an entire input to yield some output
type FilterProgram = [Line] -> [Line]
but i don't knwo
*** APOLOGIES FOR MULTIPLE POSTING **
FINAL CALL FOR PAPERS: JULY 10 DEADLINE
MoVeLog'05
Mobile Code Safety and Program Verification
Using Computational Logic Tools
An ICLP Workshop, Sitges, Spain,