[Haskell-cafe] Short tweak-run cycles with haskell-mode was Re: Parsec and destructuring HTML content

2006-06-19 Thread Shae Matijs Erisson
Joel Reymont <[EMAIL PROTECTED]> writes: > I think that developing HTML scrapers requires short tweak-compile- run > cycles and is probably best done in Perl, Python, Ruby, i.e. dynamic > languages but I wonder if someone has found otherwise. I get very short tweak-run cycles from haskell-mode i

RE:[Haskell-cafe] A function using List and Tuple

2006-06-19 Thread jotajota
Hi On 6/19/06, Sara Kenedy <[EMAIL PROTECTED]> wrote: > Hello, > > I want to creat a function sumList as below examples: > sumList [("s1",2),("s2",4),("s3",3),("s4",2)] = ("#", 1/2 + 1/4 + 1/3 + 1/2) > sumList [("s1",2),("s2",4),("s3",3) = ("#", 1/2 + 1/4 + 1/3) > > I attempted it as following: >

[Haskell-cafe] Computing lazy and strict list operations at the same time

2006-06-19 Thread C Rodrigues
Here's a puzzle I haven't been able to solve. Is it possible to write the initlast function? There are functions "init" and "last" that take constant stack space and traverse the list at most once. You can think of traversing the list as deconstructing all the (:) [] constructors in list.

Re: [Haskell-cafe] Computing lazy and strict list operations at the same time

2006-06-19 Thread Robert Dockins
On Jun 19, 2006, at 11:24 AM, C Rodrigues wrote: Here's a puzzle I haven't been able to solve. Is it possible to write the initlast function? There are functions "init" and "last" that take constant stack space and traverse the list at most once. You can think of traversing the list as

Re: [Haskell-cafe] Computing lazy and strict list operations at the same time

2006-06-19 Thread Jon Fairbairn
On 2006-06-19 at 15:24- "C Rodrigues" wrote: > Here's a puzzle I haven't been able to solve. Is it possible to write the > initlast function? > > There are functions "init" and "last" that take constant stack space and > traverse the list at most once. You can think of traversing the list

Re: [Haskell-cafe] Computing lazy and strict list operations at the same time

2006-06-19 Thread Duncan Coutts
On Mon, 2006-06-19 at 15:24 +, C Rodrigues wrote: > Here's a puzzle I haven't been able to solve. Is it possible to write the > initlast function? > > There are functions "init" and "last" that take constant stack space and > traverse the list at most once. You can think of traversing the

Re: [Haskell-cafe] Computing lazy and strict list operations at the same time

2006-06-19 Thread Jerzy Karczmarczuk
On Jun 19, 2006, at 11:24 AM, C Rodrigues wrote: Here's a puzzle I haven't been able to solve. Is it possible to write the initlast function? There are functions "init" and "last" that take constant stack space and traverse the list at most once. You can think of traversing the list a

Re: [Haskell-cafe] Computing lazy and strict list operations at the same time

2006-06-19 Thread Joel Reymont
Where's the solution and what is the repmin problem? On Jun 19, 2006, at 5:21 PM, Jerzy Karczmarczuk wrote: Such tricks become your second nature, when you take the solution (lazy) of the "repmin" problem by Richard Bird, you put it under your pillow, and sleep for one week with your head close

Re: [Haskell-cafe] Computing lazy and strict list operations at the same time

2006-06-19 Thread Duncan Coutts
On Mon, 2006-06-19 at 17:03 +0100, Jon Fairbairn wrote: > On 2006-06-19 at 15:24- "C Rodrigues" wrote: > > Here's a puzzle I haven't been able to solve. Is it possible to write the > > initlast function? > > > > There are functions "init" and "last" that take constant stack space and > > tr

Re: [Haskell-cafe] Computing lazy and strict list operations at the same time

2006-06-19 Thread Robert Dockins
On Jun 19, 2006, at 12:50 PM, Duncan Coutts wrote: On Mon, 2006-06-19 at 17:03 +0100, Jon Fairbairn wrote: On 2006-06-19 at 15:24- "C Rodrigues" wrote: Here's a puzzle I haven't been able to solve. Is it possible to write the initlast function? There are functions "init" and "last" th

Re: [Haskell-cafe] Computing lazy and strict list operations at the same time

2006-06-19 Thread jerzy . karczmarczuk
Joel Reymont writes: Where's the solution and what is the repmin problem? On Jun 19, 2006, at 5:21 PM, Jerzy Karczmarczuk wrote: Such tricks become your second nature, when you take the solution (lazy) of the "repmin" problem by Richard Bird, you put it under your pillow, and sleep for one we

[Haskell-cafe] ACross

2006-06-19 Thread Jenny678
Hello, Can somebody help me My Problem is to define a code for: >cross 7 -- means 7*7 >+++ >++ ++ >+ + + + >+++ >+ + + + >++ ++ >+++ Another Example >cross 13 -- 13*13 >+ >++ ++ >+ +

Re: [Haskell-cafe] ACross

2006-06-19 Thread Stefan Holdermans
Hi all, Can somebody help me My Problem is to define a code for: cross 7 -- means 7*7 +++ ++ ++ + + + + +++ + + + + ++ ++ +++ Not to be the bad guy, but perhaps it's a good idea to remind ourselves of our homework policy. Regards, Stefan ___

Re: [Haskell-cafe] ACross

2006-06-19 Thread Jared Updike
Not to be the bad guy, but perhaps it's a good idea to remind ourselves of our homework policy. This? http://www.haskell.org/hawiki/HomeworkHelp Can I use putString ??? If you mean putStrLn and putStr, then yes. I would first make a function that constructs the string or list of strings (m

[Haskell-cafe] Re: Efficient way to edit a file

2006-06-19 Thread Maurício
David Roundy wrote: On Fri, Jun 02, 2006 at 12:34:51PM +1000, Donald Bruce Stewart wrote: dons: briqueabraque: Hi, I need to edit big text files (5 to 500 Mb). But I just need to change one or two small lines, and save it. What is the best way to do that in Haskell, without creating co

[Haskell-cafe] cabal-get and HXT?

2006-06-19 Thread Greg Fitzgerald
I'd like to use a tool to automatically install Haskell XML Toolkit and its dependencies.  What are my options?  How's cabal-get coming?Thanks,Greg ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Computing lazy and strict list operations atthe same time

2006-06-19 Thread C Rodrigues
Ah, thanks for the replies. I like the approach that uses lazy tuples of intermediate values because it has a recognizable similarity to the original two functions. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailma

[Haskell-cafe] Newbie question on iterating over IO list

2006-06-19 Thread Taro Ikai
Here's a code fragment I have from working with Hal Daume's "Yet Another Haskell Tutorial". I cannot figure out how to iterate over the result from askForNumbers that returns "IO [Integer]", and print them. The "<-" operator seems to take IO off of the results from actions like getContents, which

Re: [Haskell-cafe] Newbie question on iterating over IO list

2006-06-19 Thread Sebastian Sylvan
On 6/20/06, Taro Ikai <[EMAIL PROTECTED]> wrote: Here's a code fragment I have from working with Hal Daume's "Yet Another Haskell Tutorial". I cannot figure out how to iterate over the result from askForNumbers that returns "IO [Integer]", and print them. The "<-" operator seems to take IO off o

Re: [Haskell-cafe] Newbie question on iterating over IO list

2006-06-19 Thread Taro Ikai
Sebastian, Thanks for your help. I learned two things: o show is not an action, but a function. Using it in the interactive mode of GHCI was making me confused. o To output anything, I need to do 'do'. -Taro Sebastian Sylvan wrote: On 6/20/06, Taro Ikai <[EMAIL PROTECTED]> wrote: Here's

Re: [Haskell-cafe] Newbie question on iterating over IO list

2006-06-19 Thread Jared Updike
o To output anything, I need to do 'do'. If you only have one action, you can omit do, e.g. main = do { putStrLn "Hello, World!" } is identical (after de-sguaring) to main = putStrLn "Hello, World!" Essentially, you are correct; to output anything (i.e. to perform I/O by side effect) your