Re: [Haskell-cafe] In for a penny, in for a pound.

2006-01-09 Thread Einar Karttunen
On 09.01 12:56, Donald Bruce Stewart wrote: Entries that may currently be worth submitting: takfp - http://www.haskell.org/hawiki/TakfpEntry Committed. pidigits (currently 2nd!) - http://www.haskell.org/hawiki/PidigitsEntry Committed. mandelbrot

Re: [Haskell-cafe] In for a penny, in for a pound.

2006-01-09 Thread Donald Bruce Stewart
ekarttun: On 09.01 12:56, Donald Bruce Stewart wrote: Entries that may currently be worth submitting: takfp - http://www.haskell.org/hawiki/TakfpEntry Committed. pidigits (currently 2nd!) - http://www.haskell.org/hawiki/PidigitsEntry Committed.

Re: [Haskell-cafe] Is there a notion for identity?

2006-01-09 Thread Tim Walkenhorst
Thanks for all infos. I'll apply that Ref-datatype from the observable sharing paper to my problem and see where this brings me. I'm also looking into the solution Paul Hudak presented in the Detecting Cycles in Datastructures thread in october. For the problem at hand (involving the STLC),

Re: [Haskell-cafe] In for a penny, in for a pound.

2006-01-09 Thread Chris Kuklewicz
Donald Bruce Stewart wrote: Entries that may currently be worth submitting: takfp - http://www.haskell.org/hawiki/TakfpEntry pidigits (currently 2nd!) - http://www.haskell.org/hawiki/PidigitsEntry mandelbrot-

Re: [Haskell-cafe] In for a penny, in for a pound.

2006-01-09 Thread Bertram Felgenhauer
Donald Bruce Stewart wrote: d: Regarding the Fannkuch Shootout Entry: If we are willing to specialize flop in the way shown on the wiki, another 8% can be gained by similarly specializing rotate: rotate 2 (x1:x2:xs) = x2:x1:xs rotate 3 (x1:x2:x3:xs) = x2:x3:x1:xs ... Cheers,

Re: [Haskell-cafe] Expanding do notation

2006-01-09 Thread Bertram Felgenhauer
David F. Place wrote: main' n = let p = permutations [1..n] in do mapM_ (putStrLn . concatMap show) $ take 30 p putStr $ Pfannkuchen( ++ show n ++ ) = putStrLn . show $ foldl' (flip (max .

Re: [Haskell-cafe] In for a penny, in for a pound.

2006-01-09 Thread Donald Bruce Stewart
bertram.felgenhauer: The flop machinery can still be made faster, stealing an idea from the icc entry (namely, treating the first entry separately): Great. This pushes the pure version up a notch. I've updated the wiki, showing how the code has progressed: Author Time in

[Haskell-cafe] Re: Chameneos

2006-01-09 Thread Simon Marlow
Bulat Ziganshin wrote: the same is for Int32 (and i think other fixed-width integrals). i just noticed that one simple loop in my program allocates 2.5 times more data and works 2 times slower when loop variable switched from Int to Int32 There's no reason that Int32 should be slower than

[Haskell-cafe] Re: Where does memory go?

2006-01-09 Thread Simon Marlow
Joel Reymont wrote: I compiled a simple one-liner: main = print Blah. This is the GC report: 5,620 bytes allocated in the heap 0 bytes copied during GC 0 collections in generation 0 ( 0.00s) 0 collections in generation 1 ( 0.00s) 1 Mb total

[Haskell-cafe] Re: Shootout favoring imperative code

2006-01-09 Thread Simon Marlow
Sebastian Sylvan wrote: It would be neat if the PackedString library contained functions such as hGetLine etc. It does have a function for reading from a buffer, but it won't stop at a newline... But yeah, fast string manipulation is difficult when using a linked-list representation... My

[Haskell-cafe] Parsec Question

2006-01-09 Thread Gerd M
I'm trying to use parsec for parsing a custom input stream. As far as I understood the manual correctly I need to define the primitive parser: type MyParser a = GenParser (SourcePos,Tok) () a mytoken :: (Tok - Maybe a) - MyParser a mytoken test = token showToken posToken testToken where

[Haskell-cafe] Run-time compilation

2006-01-09 Thread Daniel Fischer
Am Sonntag, 8. Januar 2006 15:45 schrieben Sie: Daniel Fischer wrote: Cool. So let's see if I got it. If I have n - readIO ... mapM_ (func n) list ... in my programme, the runtime system will/might build object code for func n that is then used instead of using the

Re: [Haskell-cafe] Parsec Question

2006-01-09 Thread Daniel Fischer
Am Montag, 9. Januar 2006 12:52 schrieb Gerd M: I'm trying to use parsec for parsing a custom input stream. As far as I understood the manual correctly I need to define the primitive parser: type MyParser a = GenParser (SourcePos,Tok) () a mytoken :: (Tok - Maybe a) - MyParser a mytoken

[Haskell-cafe] Re: Parsec Question

2006-01-09 Thread Christian Maeder
Hi Gerd, despite SourcePos being abstract, it can be fully manipulated using newPos. import Text.ParserCombinators.Parsec.Pos If you can compute the positions from your Tok-stream then you may consider using tokenPrim and work with GenParser Tok () a HTH Christian Gerd M wrote: I'm trying

Re: [Haskell-cafe] Run-time compilation

2006-01-09 Thread Martin Grabmueller
Daniel Fischer wrote: So back to square one. What then _is_ run-time compilation? In the virtual machine community, run-time compilation refers to the translation of program code at run-time, for example the compilation of Java byte code to machine code in a JIT (just-in-time) compiler. Other

[Haskell-cafe] hPutStrLn and hFlush

2006-01-09 Thread Gracjan Polak
Hi all,A bit strange behaviour with hPutStrLn. Consider following program:main = do handle - openFile output.txt WriteMode hPutStrLn handle (unlines contLines2) -- hFlush houtput where contLines2 = flip map [1..2000] $ \x - show x ++ been there done thatOutputs file which ends with following

Re: [Haskell-cafe] hPutStrLn and hFlush

2006-01-09 Thread Sebastian Sylvan
On 1/9/06, Sebastian Sylvan [EMAIL PROTECTED] wrote: On 1/9/06, Gracjan Polak [EMAIL PROTECTED] wrote: Hi all, A bit strange behaviour with hPutStrLn. Consider following program: main = do handle - openFile output.txt WriteMode hPutStrLn handle (unlines contLines2)

Re: [Haskell-cafe] hPutStrLn and hFlush

2006-01-09 Thread Stepan Golosunov
On Mon, Jan 09, 2006 at 04:57:51PM +0100, Gracjan Polak wrote: Hi all, A bit strange behaviour with hPutStrLn. Consider following program: main = do handle - openFile output.txt WriteMode hPutStrLn handle (unlines contLines2) -- hFlush houtput where contLines2 =

Re: [Haskell-cafe] hPutStrLn and hFlush

2006-01-09 Thread Donn Cave
On Mon, 9 Jan 2006, Stepan Golosunov wrote: On Mon, Jan 09, 2006 at 04:57:51PM +0100, Gracjan Polak wrote: ... So the output is truncated. When I uncomment hFlush, file is fully written. Is this expected/documented behaviour? This is the usual behavior when file is not closed. And example

[Haskell-cafe] Re: [Haskell] Re: haskell.org Public Domain

2006-01-09 Thread Brian Sniffen
It might be nice to at least include some disclaimers of warranty. I'm not a lawyer. But those US copyright lawyers I've spoken with have expressed doubts about anybody's ability to put things into the public domain. Certainly, if you put it in the public domain, you can't also disclaim a

[Haskell-cafe] Re: Parsec Question

2006-01-09 Thread Gerd M
despite SourcePos being abstract, it can be fully manipulated using newPos. Thanks for the tip, I thought it wasn't exported. Gerd M wrote: I'm trying to use parsec for parsing a custom input stream. As far as I understood the manual correctly I need to define the primitive parser: type

Re: [Haskell-cafe] Is there a notion for identity?

2006-01-09 Thread Robert Dockins
On Monday 09 January 2006 04:09 am, Tim Walkenhorst wrote: Thanks for all infos. I'll apply that Ref-datatype from the observable sharing paper to my problem and see where this brings me. I'm also looking into the solution Paul Hudak presented in the Detecting Cycles in Datastructures thread

Re: [Haskell-cafe] hPutStrLn and hFlush

2006-01-09 Thread John Meacham
Yeah. this is a major bug in ghc IMHO. I believe it has been fixed, but am unsure. Since we can't rely on finalizers to run in general, some sort of 'atexit' routine is needed. (which would be a good addition to the standard libraries anyway) John -- John Meacham - ⑆repetae.net⑆john⑈

Re: [Haskell-cafe] I/O and utf8

2006-01-09 Thread John Meacham
On Sun, Jan 08, 2006 at 11:26:05AM +, Andreas Kägi wrote: hello i want to read a file encoded in utf8 and at a later time output portions of it on the console. Is there an easy way to do this in haskell? using the standard i/o functions i can read the file but the output gives me \1071

Re: [Haskell-cafe] hPutStrLn and hFlush

2006-01-09 Thread Gracjan Polak
Thanks for the answers. I can go with hFlush or hClose, no problem here. Anyway this is a bit surprising that default stdout behaves different than file opened with default options. -- Gracjan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org