Re: [Haskell-cafe] Newbie: Applying Unknown Number Arguments to A Partial Function

2006-05-19 Thread Chris Kuklewicz
Aditya Siram wrote: I am trying to write a function 'applyArguments' which takes a function and a list and recursively uses element each in the list as an argument to the function. I want to do this for any function taking any number of arguments. applyArgument f (arg) = f arg

[Haskell-cafe] Re: Parsec memory behavior

2006-05-19 Thread Christian Maeder
Jeremy Shaw wrote: I am guessing that 'off-line generated parsers' means things like lex/yacc -- but I am not positive. Yes, happy is the parser generator for haskell. (and alex the corresponding lexer) Christian ___ Haskell-Cafe mailing list

[Haskell-cafe] Space leak when returning pairs?

2006-05-19 Thread Shin-Cheng Mu
Dear members, I am experiencing a space leak, which I suspect to be an instance of the problem addressed by Wadler before. I'd appreciate if someone here would take a look. Given the following datatype: data XMLEvent = StartEvent String | EndEvent String |

Re: [Haskell-cafe] Space leak when returning pairs?

2006-05-19 Thread Henning Thielemann
On Fri, 19 May 2006, Shin-Cheng Mu wrote: idX :: [XMLEvent] - ([XMLEvent], [XMLEvent]) idX [] = ([], []) idX (StartEvent a : strm) = let (ts, strm') = idX strm (us, strm'') = idX strm' in (StartEvent a [] : ts ++ EndEvent a : us, strm'') idX (EndEvent _:

Re: [Haskell-cafe] Newbie: Applying Unknown Number Arguments to A Partial Function

2006-05-19 Thread Arthur Baars
Chris, the subject states clearly that Aditya is a Newbie, and is most likely just trying to define the function map. So I think pointing to a bunch of advanced type magic tricks is not really helpful. Aditya, you say you want the function applyArgument to take a function and a list and apply

Re: [Haskell-cafe] Space leak when returning pairs?

2006-05-19 Thread Shin-Cheng Mu
Dear Henning, On May 19, 2006, at 6:16 PM, Henning Thielemann wrote: On Fri, 19 May 2006, Shin-Cheng Mu wrote: idX :: [XMLEvent] - ([XMLEvent], [XMLEvent]) idX (StartEvent a : strm) = let (ts, strm') = idX strm (us, strm'') = idX strm' in (StartEvent a [] : ts ++

Re: [Haskell-cafe] Newbie: Applying Unknown Number Arguments to A Partial Function

2006-05-19 Thread Arthur Baars
My apologies to Chris, I think I misinterpreted Aditya's description. Thanks to David House for telling me. I thought he was describing a function such as map instead of polyvaric functions, which would have been more likely for a newbie :-) So to answer Aditya's question, whether you can do

Re: [Haskell-cafe] Space leak when returning pairs?

2006-05-19 Thread Malcolm Wallace
Henning Thielemann [EMAIL PROTECTED] wrote: let ~(ts, strm') = idX strm ~(us, strm'') = idX strm' Let-bindings are already lazy, so the ~ here is redundant. Regards, Malcolm ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Space leak when returning pairs?

2006-05-19 Thread Shin-Cheng Mu
On May 19, 2006, at 6:16 PM, Henning Thielemann wrote: let ~(ts, strm') = idX strm ~(us, strm'') = idX strm' I seem to have found a partial solution to the problem. It's rather ugly, however, and I think there should be a better way. The original definition for one of the clauses was

Re: [Haskell-cafe] Space leak when returning pairs?

2006-05-19 Thread Chris Kuklewicz
Shin-Cheng Mu wrote: Dear members, I am experiencing a space leak, which I suspect to be an instance of the problem addressed by Wadler before. I'd appreciate if someone here would take a look. Given the following datatype: data XMLEvent = StartEvent String | EndEvent

Re: [Haskell-cafe] Space leak when returning pairs?

2006-05-19 Thread Malcolm Wallace
Shin-Cheng Mu [EMAIL PROTECTED] wrote: I was wondering where the space leak came from and suspected that it's the leak described in one of Philip Wadler's early paper Fixing Some Space Leaks With a Garbage Collector (1987). But since Wadler has addressed this problem a long time ago, I

Re: [Haskell-cafe] Newbie: Applying Unknown Number Arguments to A Partial Function

2006-05-19 Thread Jeremy Shaw
Hello, You can do it -- but it may not be very useful in its current form. The primary problem is, What is the type of 'f'? applyArgument f [arg] = f arg -- NOTE: I changed (arg) to [arg] applyArgument f (arg:args) = applyArgument (f arg) args Looking at the second line, it seems that f is a

Re: [Haskell-cafe] Newbie: Applying Unknown Number Arguments to A Partial Function

2006-05-19 Thread Robert Dockins
On May 19, 2006, at 2:49 PM, Jeremy Shaw wrote: Hello, You can do it -- but it may not be very useful in its current form. The primary problem is, What is the type of 'f'? applyArgument f [arg] = f arg -- NOTE: I changed (arg) to [arg] applyArgument f (arg:args) = applyArgument (f arg) args

[Haskell-cafe] Re: GNUPlot

2006-05-19 Thread Henning Thielemann
On Tue, 16 May 2006, Donald Bruce Stewart wrote: lemming: I have a wrapper for basic GNUPlot control: http://www.math.uni-bremen.de/~thielema/Research/GNUPlot.hs More secret modules! Could you stick a link to this on the haskell.org wiki please, under libraries and tools somewhere? I've

Re: [Haskell-cafe] Newbie: Applying Unknown Number Arguments to A Partial Function

2006-05-19 Thread Greg Buchholz
Aditya Siram wrote: ] I am trying to write a function 'applyArguments' which takes a function and ] a list and recursively uses element each in the list as an argument to the ] function. I want to do this for any function taking any number of arguments. ] ] applyArgument f (arg) = f arg ]

[Haskell-cafe] Re: [Haskell] installing streams library

2006-05-19 Thread Chad Scherrer
Thanks Jared, but already tried those. I was able to download the Streams library, but I have know idea how to install it.On 5/19/06, Jared Updike [EMAIL PROTECTED] wrote:I found this in an old post (gotta love GMail search): You can find further information about the library at the page

Re: [Haskell-cafe] Newbie: Applying Unknown Number Arguments to A Partial Function

2006-05-19 Thread Greg Buchholz
Greg Buchholz wrote: instance Apply a b c = Apply (a-b) b (a,c) where Whoops, instead of that, I think I meant... instance Apply (b-c) c d = Apply (a-b-c) (b-c) (a,d) where ...where we strip off one layer of types, because of the recursion. Of course, that still doesn't work though. Greg

[Haskell-cafe] parsing machine-generated natural text

2006-05-19 Thread Evan Martin
For a toy project I want to parse the output of a program. The program runs on someone else's machine and mails me the results, so I only have access to the output it generates, Unfortunately, the output is intended to be human-readable, and this makes parsing it a bit of a pain. Here are some