Re: [Haskell-cafe] XML parser recommendation?

2007-10-22 Thread Henning Thielemann
On Mon, 22 Oct 2007, Yitzchak Gale wrote: > Henning Thielemann wrote: > > HXT uses Parsec, which is strict. > > Is is strict to the extent that it cannot produce any > output at all until it has read the entire XML document? Yep. You might like to check my XML wrapper library which interfaces t

Re: [Haskell-cafe] will the real quicksort please stand up? (or: sorting a > million element list)

2007-10-22 Thread Bernie Pope
On 23/10/2007, at 8:09 AM, Thomas Hartman wrote: (Prelude sort, which I think is mergesort, just blew the stack.) GHC uses a "bottom up" merge sort these days. It starts off by creating a list of singletons, then it repeatedly merges adjacent pairs of lists until there is only one list l

Re: [Haskell-cafe] Polymorphic (typeclass) values in a list?

2007-10-22 Thread TJ
On 10/22/07, Tim Docker <[EMAIL PROTECTED]> wrote: > [...] > You may then like to add a type class to turn things into renderables: > > class IsRenderable where > toRenderable :: a -> Renderable > > instance IsRendeable Point where ... > instance IsRenderable Line where ... > [...] Cool. I sho

Re: [Haskell-cafe] Function Types

2007-10-22 Thread Bernie Pope
I have implemented a reasonably simple language and interpreter called "baskell". The language is essentially a very small subset of Haskell. It was designed to show students how type checking works. You can find it here: http://www.cs.mu.oz.au/~bjpop/code.html Cheers, Bernie. On 23/10/2007

Re: [Haskell-cafe] Transformation sequence

2007-10-22 Thread R Hayes
I know that this is a resolved question, but wouldn't Huet's Zipper also work for this On Oct 20, 2007, at 5:26 PM, Alfonso Acosta wrote: On 10/20/07, Mads Lindstrøm <[EMAIL PROTECTED]> wrote: I am not a monad-expect, so I may be wrong, but wouldn't a writer monad be more appropriate?

Re: [Haskell-cafe] wordsBy in the base libraries?

2007-10-22 Thread Richard A. O'Keefe
On 22 Oct 2007, at 10:50 pm, Neil Mitchell wrote: wordsBy :: (a -> Bool) -> [a] -> [[a]] wordsBy p s = case dropWhile p s of [] -> [] s':rest -> (s':w) : wordsBy p (drop 1 s'') where (w, s'') = break p rest For things like this, I think it may be easier to just write down

Re: [Haskell-cafe] Function Types

2007-10-22 Thread Matthew Brecknell
PR Stanley: > f x = x > x :: a > f x :: b > therefore f :: a -> b > x = a and x = b > therefore a = b > therefore f :: a -> a > Simple mappings are easy to work out. It's the more detailed stuff > I'm not sure about. You've got the right idea. Type inference involves a process called unification.

Re: [Haskell-cafe] Function Types

2007-10-22 Thread Brandon S. Allbery KF8NH
On Oct 22, 2007, at 22:41 , PR Stanley wrote: f x = x x :: a f x :: b therefore f :: a -> b x = a and x = b therefore a = b therefore f :: a -> a Simple mappings are easy to work out. It's the more detailed stuff I'm not sure about. f g x y = g x (y x) I think you're looking for Hindley-Mi

Re: [Haskell-cafe] ANN: Math.OEIS 0.1

2007-10-22 Thread Cale Gibbard
On 22/10/2007, Brent Yorgey <[EMAIL PROTECTED]> wrote: > Now, if the OEIS stored *Haskell* code to generate sequences... > > -Brent > Yeah, that would be rather nice. :) I think I have seen Haskell code on a few of the entries, even, but I don't know how standard the format is. ___

Re: [Haskell-cafe] Function Types

2007-10-22 Thread Tim Chevalier
On 10/22/07, PR Stanley <[EMAIL PROTECTED]> wrote: > f x = x > x :: a > f x :: b > therefore f :: a -> b > x = a and x = b > therefore a = b > therefore f :: a -> a > Simple mappings are easy to work out. It's the more detailed stuff > I'm not sure about. > f g x y = g x (y x) > Benjamin Pierce's

Re: [Haskell-cafe] OS Abstraction module??

2007-10-22 Thread Galchin Vasili
Hi Ryan, Thanks for your generous response. " By the way, you don't want to use typeclasses here; they solve the problem of having more than one possible interface at runtime, whereas you only care about compile-time" .. in reality I do care about decisions made at run-time (this just struck m

Re: [Haskell-cafe] Function Types

2007-10-22 Thread PR Stanley
f x = x x :: a f x :: b therefore f :: a -> b x = a and x = b therefore a = b therefore f :: a -> a Simple mappings are easy to work out. It's the more detailed stuff I'm not sure about. f g x y = g x (y x) Cheers, Paul At 03:15 23/10/2007, you wrote: On 10/22/07, PR Stanley <

Re: [Haskell-cafe] will the real quicksort please stand up? (or: sorting a > million element list)

2007-10-22 Thread Brent Yorgey
> I wonder if there are "tricks" or lore that could be applied to get better > results or insight. > > t. Just a quick note, I doubt ghc -e does any optimizations. You'd probably get better results by putting these tests in files and compiling with -O2. In particular I wonder whether that would

Re: [Haskell-cafe] Function Types

2007-10-22 Thread Brent Yorgey
On 10/22/07, PR Stanley <[EMAIL PROTECTED]> wrote: > > Hi > What are the rules for calculating function types? > Is there a set procedure ? > Thanks, Paul There must be a set procedure, since otherwise the compiler could not function! =) Seriously, though, I'm not exactly sure what you're asking

Re: [Haskell-cafe] ANN: Math.OEIS 0.1

2007-10-22 Thread Brent Yorgey
On 10/22/07, Cale Gibbard <[EMAIL PROTECTED]> wrote: > > Uh, not quite. My code essentially treats mathematica as a function on > strings, (and involves some additional shell wrapping), since there's > essentially no processing to do on the Haskell side there. If you > wanted to do it right, you'd

Re: [Haskell-cafe] OS Abstraction module??

2007-10-22 Thread Ryan Ingram
Also, note that it's really easy to hide all the CPP uglyness in a single file, or do it with Makefiles, or something along those lines. By the way, you don't want to use typeclasses here; they solve the problem of having more than one possible interface at runtime, whereas you only care about com

[Haskell-cafe] Function Types

2007-10-22 Thread PR Stanley
Hi What are the rules for calculating function types? Is there a set procedure ? Thanks, Paul ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] ANN: Math.OEIS 0.1

2007-10-22 Thread Cale Gibbard
Uh, not quite. My code essentially treats mathematica as a function on strings, (and involves some additional shell wrapping), since there's essentially no processing to do on the Haskell side there. If you wanted to do it right, you'd probably want to write an FFI binding to MathLink. On 22/10/20

Re: [Haskell-cafe] will the real quicksort please stand up? (or: sorting a > million element list)

2007-10-22 Thread jerzy . karczmarczuk
Thomas Hartman writes: another point: "deforested" treesort is slower. The commented indicated that -- If you deforest this algorithm (removing the intermediate tree structure) you are left with treeSort' [] = [] treeSort' (x:xs) = treeSort' (filter (<= x) xs) ++ [x] ++ treeSort' (filter (

Re: [Haskell-cafe] Re: XML parser recommendation?

2007-10-22 Thread Justin Bailey
On 10/22/07, Rene de Visser <[EMAIL PROTECTED]> wrote: > > I had a look at using HXT awhile ago. Parsec is the least of the problems. > HXT stores the XML as an explicit tree in memory, where the head has > explict > references to the children. What did you end up using? I've started building an

Re: [Haskell-cafe] Re: How much of Haskell was possible 20 years ago?

2007-10-22 Thread Duncan Coutts
On Mon, 2007-10-22 at 10:05 -0700, Jeremy Shaw wrote: > > >> I like Haskell, and use it as my main > > >> language. However, compiling a Haskell program > > >> usually takes a lot of memory and CPU. > > Last night I was running top, and noticed cc1 consuming 101MB of RAM > :) I have also seen ar

Re: [Haskell-cafe] will the real quicksort please stand up? (or: sorting a > million element list)

2007-10-22 Thread Thomas Hartman
another point: "deforested" treesort is slower. [EMAIL PROTECTED]:~/ProjectRepos/learning/quicksort>time ghc -e "test treeSort' 6" quicksort 100 real4m3.615s user1m59.525s sys 0m0.587s The commented indicated that -- If you deforest this algorithm (removing the intermediate tr

[Haskell-cafe] will the real quicksort please stand up? (or: sorting a > million element list)

2007-10-22 Thread Thomas Hartman
It has been noted in a few places that the 2 line quicksort demo in the Introduction section of the haskell wiki http://www.haskell.org/haskellwiki/Introduction isn't a "real" quicksort, and wouldn't scale well with longer lists. Interested, and wanting to put my recently learned test data gen

Re: [Haskell-cafe] Tutorial: Curry-Howard Correspondence

2007-10-22 Thread Roberto Zunino
I must confess that I find choosing type Prop = CProp () to be slightly dangerous, since now CProp (const ()) :: Prop p and there is nothing in that expression that suggests non-termination (~ "invalid" proof). I would rather choose a type admitting only _|_ as its value: type Prop = CP

Re: [Haskell-cafe] Beginners problem with the type system

2007-10-22 Thread Bulat Ziganshin
Hello Henrik, Monday, October 22, 2007, 10:02:20 PM, you wrote: > In particular, I want to define two classes 'Channel' and 'Port' (see > below) that define a common interface for several concrete > implementations with different synchronization characteristics. may be this my code will be use

Re[2]: [Haskell-cafe] OS Abstraction module??

2007-10-22 Thread Bulat Ziganshin
Hello Galchin, Monday, October 22, 2007, 8:41:09 PM, you wrote: >     I am really talking about a module or perhaps a Haskell class > that provides notion for multiple threads of execution, semaphores, > .. that "hides" POSIX vs Win32 APIs .. i.e. the underlying OS APIs sometimes ago i ported m

Re: [Haskell-cafe] Tutorial: Curry-Howard Correspondence

2007-10-22 Thread Dan Weston
Derek and Lennart, Thank you both for your clarifications. Tutorials (and blogs) of the C-H correspondence and the naive (i.e. set-theoretic) categorical descriptions of Haskell are so eager to get to the insights you mention that they gloss too easily over the important role of _|_, a term I

Re: [Haskell-cafe] Local Search Module

2007-10-22 Thread David F. Place
On Oct 22, 2007, at 3:00 PM, Jeremy Shaw wrote: Well, the most important part has not been done -- as you noted there is no library on hackage. It would be excellent if you could: 1. talk the upstream author's into releasing the source under BSD 2. cabalize / haddock it and upload to hackag

Re: [Haskell-cafe] Local Search Module

2007-10-22 Thread Jeremy Shaw
At Mon, 22 Oct 2007 14:45:51 -0400, David F. Place wrote: > > > On Oct 22, 2007, at 2:26 PM, Jeremy Shaw wrote: > > > Hello, > > > > If you have not seen this paper, you may enjoy it: > > > > Modular Lazy Search for Constraint Satisfaction Problems (2001) > > Thomas Nordin, Andrew Tolmach > > >

Re: [Haskell-cafe] Local Search Module

2007-10-22 Thread David F. Place
On Oct 22, 2007, at 2:26 PM, Jeremy Shaw wrote: Hello, If you have not seen this paper, you may enjoy it: Modular Lazy Search for Constraint Satisfaction Problems (2001) Thomas Nordin, Andrew Tolmach http://citeseer.ist.psu.edu/608419.html Yes, perfect. It seems that the work is already

Re: [Haskell-cafe] Local Search Module

2007-10-22 Thread Jeremy Shaw
Hello, If you have not seen this paper, you may enjoy it: Modular Lazy Search for Constraint Satisfaction Problems (2001) Thomas Nordin, Andrew Tolmach http://citeseer.ist.psu.edu/608419.html j. At Mon, 22 Oct 2007 10:19:52 -0400, David F. Place wrote: > > Dear [Reader]: > > Recently, I nee

[Haskell-cafe] Re: XML parser recommendation?

2007-10-22 Thread Rene de Visser
"Yitzchak Gale" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] > Henning Thielemann wrote: >> HXT uses Parsec, which is strict. I had a look at using HXT awhile ago. Parsec is the least of the problems. HXT stores the XML as an explicit tree in memory, where the head has explict

Re: [Haskell-cafe] Beginners problem with the type system

2007-10-22 Thread Stefan O'Rear
On Mon, Oct 22, 2007 at 08:02:20PM +0200, Henrik Tramberend wrote: > Dear Hasekellers, > > I am trying to build some abstractions on top of the module > Control.Concurrent and run into a problem with the type system that I do > not understand. > > In particular, I want to define two classes 'Chan

[Haskell-cafe] Back on opengl win32 again? no window

2007-10-22 Thread bbrown
Ok, sorry to bring this back up again. I asked before and kind of went to a working linux system. My question; On Win32, has anyone seen where you try to run the application but the window will not stay open. There are no errors, the window with 3D objects will not stay open. I was using a

[Haskell-cafe] Beginners problem with the type system

2007-10-22 Thread Henrik Tramberend
Dear Hasekellers, I am trying to build some abstractions on top of the module Control.Concurrent and run into a problem with the type system that I do not understand. In particular, I want to define two classes 'Channel' and 'Port' (see below) that define a common interface for several co

[Haskell-cafe] Hugs on Windows

2007-10-22 Thread Galchin Vasili
Hello, If I run hugs from cygwin, I should be able to get Posix functionality? Kind regards, Bill Halchin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] OS Abstraction module??

2007-10-22 Thread Galchin Vasili
yep FFI On 10/22/07, Neil Mitchell <[EMAIL PROTECTED]> wrote: > > Hi Bill, > > > > > I am really talking about a module or perhaps a Haskell class > that > > > > provides notion for multiple threads of execution, semaphores, .. > that > > > > "hides" POSIX vs Win32 APIs .. i.e. the underl

Re: [Haskell-cafe] ANN: Math.OEIS 0.1

2007-10-22 Thread Stefan O'Rear
On Mon, Oct 22, 2007 at 07:20:47AM -0400, Brent Yorgey wrote: > * returning a lazy infinite list for infinite sequences via an embedded > general AI and Mathematica interpreter. Assuming you have a licensed copy of Mathematica, get in touch with Cale Gibbard; he has done all the work for interfaci

Re: [Haskell-cafe] OS Abstraction module??

2007-10-22 Thread Tim Chevalier
On 10/22/07, Neil Mitchell <[EMAIL PROTECTED]> wrote: > The key thing to note about this is that whether a program is running > on Windows or Posix is fixed at compile time. Things like classes can > do some of what you seem to be after, but it tends to be easier to > reach for the C pre processor.

Re: [Haskell-cafe] OS Abstraction module??

2007-10-22 Thread Neil Mitchell
Hi Bill, > > > I am really talking about a module or perhaps a Haskell class that > > > provides notion for multiple threads of execution, semaphores, .. that > > > "hides" POSIX vs Win32 APIs .. i.e. the underlying OS APIs would be > totally > > > hidden. > > > > I think you are thinking in a

Re: [Haskell-cafe] OS Abstraction module??

2007-10-22 Thread Tim Chevalier
On 10/22/07, Galchin Vasili <[EMAIL PROTECTED]> wrote: > > ^^ how? If I define something like "class OS where " and define a > POSIX instance of "class OS" and a Win32 API instance.. function calls will > be to the instances and hence the OS APIs are visible. Yes? I'm not sure what you me

Re: [Haskell-cafe] OS Abstraction module??

2007-10-22 Thread Galchin Vasili
PS so far there are only a hand full of FPL shops .. like http://www.galois.com, http://www.skydesk.com, http://www.janestcapital.com/ . On 10/22/07, Galchin Vasili <[EMAIL PROTECTED]> wrote: > > Hi Neil, > > You misunderstand me. I am really tired of imperative langauges like > C/C++ .. I wor

Re: [Haskell-cafe] OS Abstraction module??

2007-10-22 Thread Galchin Vasili
Hi Neil, You misunderstand me. I am really tired of imperative langauges like C/C++ .. I work in industry (for a long time) and have programmed in ANSI C for more than 10 years. Please see my interleaves below. Regards, Bill On 10/22/07, Neil Mitchell <[EMAIL PROTECTED]> wrote: > > Hi Bill

Re: [Haskell-cafe] Re: How much of Haskell was possible 20 years ago?

2007-10-22 Thread Jeremy Shaw
At Sun, 21 Oct 2007 17:21:00 -0200, Maurí­cio wrote: > > Brandon S. Allbery KF8NH escreveu: > > > > On Oct 21, 2007, at 14:40 , Maurí cio wrote: > > > >> I like Haskell, and use it as my main > >> language. However, compiling a Haskell program > >> usually takes a lot of memory and CPU. Last n

Re: [Haskell-cafe] OS Abstraction module??

2007-10-22 Thread Galchin Vasili
Hi Tim (and Neal), I am thinking of notions in addition to concurrency. Let me come up with a hypothetical list and repost. I worked on an "single login" project at Ford Motors and we implemnted an OS abstraction layer in C++ ( .. the collection of OS "functions" where defined in a C++ abstact

Re: [Haskell-cafe] OS Abstraction module??

2007-10-22 Thread Neil Mitchell
Hi Bill > I am really talking about a module or perhaps a Haskell class that > provides notion for multiple threads of execution, semaphores, .. that > "hides" POSIX vs Win32 APIs .. i.e. the underlying OS APIs would be totally > hidden. I think you are thinking in a "C" way. In Haskell, port

Re: [Haskell-cafe] OS Abstraction module??

2007-10-22 Thread Tim Chevalier
On 10/22/07, Galchin Vasili <[EMAIL PROTECTED]> wrote: > Hi Neil, > > I am really talking about a module or perhaps a Haskell class that > provides notion for multiple threads of execution, semaphores, .. that > "hides" POSIX vs Win32 APIs .. i.e. the underlying OS APIs would be totally > hidde

Re: [Haskell-cafe] string literals and haskell'

2007-10-22 Thread Derek Elkins
On Mon, 2007-10-22 at 17:12 +0100, Neil Mitchell wrote: > Hi > > I can see problems with this. This comes up when typing windows file path's: > > "C:\path to my\directory\boo" > > If this now reports no errors, who wants to guess which come up as > escape codes, and which don't. The way other la

Re: [Haskell-cafe] What algorithm to use ?

2007-10-22 Thread Derek Elkins
On Mon, 2007-10-22 at 10:09 +0200, manu wrote: > Hello > > I am not sure it is appropriate to post to this mailing list to > inquire about a peculiar algorithm, if not let me know... > > I was looking at one particular puzzle posted on the Facebook site, > 'Wiretaps' (http://www.facebook.com/

Re: [Haskell-cafe] OS Abstraction module??

2007-10-22 Thread Galchin Vasili
Hi Neil, I am really talking about a module or perhaps a Haskell class that provides notion for multiple threads of execution, semaphores, .. that "hides" POSIX vs Win32 APIs .. i.e. the underlying OS APIs would be totally hidden. The reason I bring this up is that OS abstraction layers are ve

Re: [Haskell-cafe] OS Abstraction module??

2007-10-22 Thread Neil Mitchell
> Besides GUI stuff, in what modules are the platform neutral stuff > implemented? Or how > do I look for this code? Most of the code is platform neutral. A few specific bits (System.Posix, System.Win32) are limited to one operating system, but that's hardly any of it. If you just write code,

Re: [Haskell-cafe] OS Abstraction module??

2007-10-22 Thread Neil Mitchell
Hi Bill, > In the Haskell libraries, is there an OS abstraction module, that would > "hide" the POSIX API and Win-32 API? If not, this would be nice so that > Haskell "programs" could be written in an OS independent manner! Yes, Haskell provides a fairly complete API in the base libraries, w

Re: [Haskell-cafe] string literals and haskell'

2007-10-22 Thread Neil Mitchell
Hi I can see problems with this. This comes up when typing windows file path's: "C:\path to my\directory\boo" If this now reports no errors, who wants to guess which come up as escape codes, and which don't. The way other languages like C# have dealt with this is by introducing a new type of quo

[Haskell-cafe] OS Abstraction module??

2007-10-22 Thread Galchin Vasili
Hello, In the Haskell libraries, is there an OS abstraction module, that would "hide" the POSIX API and Win-32 API? If not, this would be nice so that Haskell "programs" could be written in an OS independent manner! Kind regards, Bill Halchin ___ H

[Haskell-cafe] string literals and haskell'

2007-10-22 Thread David Roundy
I've just been annoyed with errors ghc reports when I use a string literal such as ":\/:" (which is a contructor in darcs). Of course, it wants ":\\/:", but I'd rather type the former. Is there any reason why the language couldn't be modified (e.g. in haskell') to make the former legal? i.e. to t

Re: [Haskell-cafe] Local Search Module -> Renaissance polyphony

2007-10-22 Thread David F. Place
On Oct 22, 2007, at 10:56 AM, Henning Thielemann wrote: On Mon, 22 Oct 2007, David F. Place wrote: BTW, the problem I am working on is an automated approach to lifting pieces of Renaissance polyphony from 3-limit to 5-limit Just Intonation. I don't understand this sentence, but it sounds

Re: [Haskell-cafe] Local Search Module -> Renaissance polyphony

2007-10-22 Thread Henning Thielemann
On Mon, 22 Oct 2007, David F. Place wrote: > BTW, the problem I am working on is an automated approach to lifting > pieces of Renaissance polyphony from 3-limit to 5-limit Just Intonation. I don't understand this sentence, but it sounds like Music processing, which I'm interested in. (See darcs.

Re: [Haskell-cafe] ANN: Math.OEIS 0.1

2007-10-22 Thread Brent Yorgey
> > The Online Encyclopedia of Integer Sequences should really contain more > Haskell code for describing the sequences. > Agreed! I propose an "OEIS party" where we all sit around one day and submit Haskell code. =) (I'm only half joking...) -Brent _

Re: [Haskell-cafe] ANN: Math.OEIS 0.1

2007-10-22 Thread Valery V. Vorotyntsev
On 10/22/07, Henning Thielemann <[EMAIL PROTECTED]> wrote: > > Cute! +1 http://programming.reddit.com/info/5yuhf/comments/ -- vvv ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Local Search Module

2007-10-22 Thread David F. Place
Dear [Reader]: Recently, I needed to solve a constraint satisfaction problem. So I coded a solution using backtracking and tabu lists. I was pleased to see how easy it is in Haskell. As an exercise, I created a module and a class interface for the search algorithm. That was also a ple

Re: [Haskell-cafe] XML parser recommendation?

2007-10-22 Thread Yitzchak Gale
Henning Thielemann wrote: > HXT uses Parsec, which is strict. Is is strict to the extent that it cannot produce any output at all until it has read the entire XML document? That would make HXT (and Parsec, for that matter) useless for a large percentage of tasks. Or is it just too strict in certa

Re: [Haskell-cafe] ANN: Math.OEIS 0.1

2007-10-22 Thread Henning Thielemann
On Mon, 22 Oct 2007, Brent Yorgey wrote: > Hi all, > > I'm pleased to announce the release of a somewhat silly -- yet perhaps > somewhat useful -- library module, > Math.OEIS, > intended for the enjoyment of combinatorial dilett

Re: [Haskell-cafe] XML parser recommendation?

2007-10-22 Thread Henning Thielemann
On Mon, 22 Oct 2007, Ketil Malde wrote: > I'm wondering what approach others use for non-toy XML data. Is the > problem due to some error I have made, or should I just ignore the > XML, and just parse it "manually" by dissecting bytestrings, or will > another XML library serve better? HXT uses P

Re: [Haskell-cafe] wordsBy in the base libraries?

2007-10-22 Thread Yitzchak Gale
Neil Mitchell wrote: > ...Also remember that > p may be arbitrarily expensive, while a test for an empty list is > cheap. In the particular case of words, p (i.e. isSpace) is very > expensive... > A reasonable level of optimisation for this function would be that the > predicate is invoked at most

[Haskell-cafe] ANN: Math.OEIS 0.1

2007-10-22 Thread Brent Yorgey
Hi all, I'm pleased to announce the release of a somewhat silly -- yet perhaps somewhat useful -- library module, Math.OEIS, intended for the enjoyment of combinatorial dilettantes, Project Euler addicts, and the merely curious a

[Haskell-cafe] Re: [Haskell] Re: Trying to install binary-0.4

2007-10-22 Thread Duncan Coutts
On Sun, 2007-10-21 at 23:42 +0200, Udo Stenzel wrote: > Duncan Coutts wrote: > > You can hack the .cabal file further to make it work in your situation, > > but I don't suggest that's a great long term solution. If you wanted to > > hack it you'd change it to just: > > > > build-depends: base, byt

Re: [Haskell-cafe] What algorithm to use ?

2007-10-22 Thread Brent Yorgey
On 10/22/07, manu <[EMAIL PROTECTED]> wrote: > > Hello > > I am not sure it is appropriate to post to this mailing list to > inquire about a peculiar algorithm, if not let me know... > > I was looking at one particular puzzle posted on the Facebook site, > 'Wiretaps' (http://www.facebook.com/jobs_p

Re: [Haskell-cafe] wordsBy in the base libraries?

2007-10-22 Thread Yitzchak Gale
How about this: wordsBy :: (a -> Bool) -> [a] -> [[a]] wordsBy p (x:xs) = if p x then wordsBy p xs else let (w, t) = getNextWord xs in (x:w) : t where getNextWord (x:xs) = if p x then ([], wordsBy p xs) else let (w, t) = g

Re: [Haskell-cafe] wordsBy in the base libraries?

2007-10-22 Thread Neil Mitchell
Hi > If you want to guarantee that level of optimization, > you probably have to inline everything by hand > and not use any library functions at all. I wonder how > much of that is already done by the compiler, > though. A reasonable level of optimisation for this function would be that the pred

Re: [Haskell-cafe] wordsBy in the base libraries?

2007-10-22 Thread Neil Mitchell
Hi > > You are still over by one test. Try instead: > > > > wordsBy :: (a -> Bool) -> [a] -> [[a]] > > wordsBy p s = case dropWhile p s of > >[] -> [] > >s':rest -> (s':w) : wordsBy p (drop 1 s'') > > where (w, s'') = break p rest > > This still has the redundant empty list

Re: [Haskell-cafe] What algorithm to use ?

2007-10-22 Thread Brandon S. Allbery KF8NH
On Oct 22, 2007, at 4:09 , manu wrote: However looking at the number of permutations (26! = 40329146112660563558400), quickly dampened my enthusiasm... There must be some algorithm (dynamic programming ?), that cuts down the number of calculations involved in order to find the right

Re: [Haskell-cafe] wordsBy in the base libraries?

2007-10-22 Thread Yitzchak Gale
Neil Mitchell wrote: > You are still over by one test. Try instead: > > wordsBy :: (a -> Bool) -> [a] -> [[a]] > wordsBy p s = case dropWhile p s of >[] -> [] >s':rest -> (s':w) : wordsBy p (drop 1 s'') > where (w, s'') = break p rest This still has the redundant empty list

Re: [Haskell-cafe] wordsBy in the base libraries?

2007-10-22 Thread Yitzchak Gale
Maxime Henrion wrote: > This version takes care of avoiding a redundant character check It still has several redundant checks: s'' is known to begin with space if it is non-empty, but that is checked again in the recursive call of wordsBy. In fact, break already checked whether s'' is empty, but

Re: [Haskell-cafe] wordsBy in the base libraries?

2007-10-22 Thread Maxime Henrion
Jules Bean wrote: > Maxime Henrion wrote: > > Hello all, > > > > > >What do you think about having a wordsBy function in the standard > >libraries? It often comes in handy. > > I speculate (but don't know) that the reason we don't have one is that > there are quite a few choices to make: >

Re: [Haskell-cafe] wordsBy in the base libraries?

2007-10-22 Thread Jules Bean
Maxime Henrion wrote: Hello all, What do you think about having a wordsBy function in the standard libraries? It often comes in handy. I speculate (but don't know) that the reason we don't have one is that there are quite a few choices to make: * delimiter as function (Char -> Boo

Re: [Haskell-cafe] XML parser recommendation?

2007-10-22 Thread Neil Mitchell
Hi Ketil, > I'm struggling to get my HXT-based parser to parse a largish file > (<300MB), even after breaking into reasonably-sized chunks. The > culprit appears to be parsing one element comprising 25K lines of > text, which apparently requires more memory than the 2Gb my computer > is equipped

Re: [Haskell-cafe] wordsBy in the base libraries?

2007-10-22 Thread Neil Mitchell
Hi We certainly need a function to split a list into sections. Whether it be wordsBy, or something like linesBy, or some new split variant. > > > wordsBy :: (a -> Bool) -> [a] -> [[a]] > > > wordsBy p s = case dropWhile p s of > > > [] -> [] > > > s':rest -> (s':w) : wordsBy p s'' > > >

[Haskell-cafe] XML parser recommendation?

2007-10-22 Thread Ketil Malde
Hi, I'm struggling to get my HXT-based parser to parse a largish file (<300MB), even after breaking into reasonably-sized chunks. The culprit appears to be parsing one element comprising 25K lines of text, which apparently requires more memory than the 2Gb my computer is equipped with. I'm won

Re: [Haskell-cafe] wordsBy in the base libraries?

2007-10-22 Thread Maxime Henrion
This got a bit mangled, here's the fixed version: > > wordsBy :: (a -> Bool) -> [a] -> [[a]] > > wordsBy p s = case dropWhile p s of > > [] -> [] > > s':rest -> (s':w) : wordsBy p s'' > > where (w, s'') = break p rest ___ Haskell-Cafe mailin

[Haskell-cafe] wordsBy in the base libraries?

2007-10-22 Thread Maxime Henrion
Hello all, What do you think about having a wordsBy function in the standard libraries? It often comes in handy. > wordsBy :: (a -> Bool) -> [a] -> [[a]] > wordsBy p s = case dropWhile p s of > [] -> [] > ':rest -> (s':w) : wordsBy p s'' > where (w, s'') = break p rest Thi

[Haskell-cafe] Re: ANN: Haskell89 grammar extended with links to online report

2007-10-22 Thread Torbjorn Tornkvist
Excellent! --Tobbe Peter Hercek wrote: > Hi, > > I extended the hyperlinked Haskell 98 grammar so that each > production now contains also links to all the sections > in the online report which explicitly name it. > > I needed it few times myself so I added it. Some people > expressed inter

[Haskell-cafe] Re: Strange subtract operator behavior - and lazy naturals

2007-10-22 Thread Aaron Denney
On 2007-10-21, Yitzchak Gale <[EMAIL PROTECTED]> wrote: > I wrote: > > Yitzchak Gale wrote: >>> So why not make the laziness available >>> also for cases where "1 - 2 == 0" does _not_ do >>> the right thing? >>> data LazyInteger = IntZero | IntSum Bool Integer LazyInteger >>> or >>> data LazyIntege

[Haskell-cafe] What algorithm to use ?

2007-10-22 Thread manu
Hello I am not sure it is appropriate to post to this mailing list to inquire about a peculiar algorithm, if not let me know... I was looking at one particular puzzle posted on the Facebook site, 'Wiretaps' (http://www.facebook.com/jobs_puzzles/?puzzle_id=11). Briefly, you have 26 program