Re: [Haskell-cafe] A few questions on primes generating.

2007-08-13 Thread Andrew Coppin
Stefan O'Rear wrote: Also, large numbers don't (this is arguably a bug...) have restricted types: [EMAIL PROTECTED]:~$ ghc -e '100 :: Int' -1486618624 So many other programming languages allow weird things to happen with numeric overflows... it would be nice if Haskell

Re: [Haskell-cafe] out of core computing in haskell

2007-08-13 Thread Andrew Coppin
Carter T Schonwald wrote: Hello Everyone, I'm not quite sure if I'm posing this question correctly, but what facilities currently exist in haskell to nicely deal with datastructures that won't fit within a given machine's ram? And if there are no such facilities, what would it take to fix

[Haskell-cafe] Remember the future

2007-08-17 Thread Andrew Coppin
I've seen comments in various places that monads allow you to borrow things from the future. That sounds completely absurd to me... can anybody explain? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Remember the future

2007-08-17 Thread Andrew Coppin
Gwern Branwen wrote: On 0, Andrew Coppin [EMAIL PROTECTED] scribbled: I've seen comments in various places that monads allow you to borrow things from the future. That sounds completely absurd to me... can anybody explain? Take a look at issue 6 of The Monad Reader; search for time

Re: [Haskell-cafe] Remember the future

2007-08-18 Thread Andrew Coppin
Dan Piponi wrote: On 8/17/07, Dan Piponi [EMAIL PROTECTED] wrote: On 8/17/07, Andrew Coppin [EMAIL PROTECTED] wrote: That sounds completely absurd to me... can anybody explain? Except...you can switch on ghc's special time travel features... On reflection I decided my

[Haskell-cafe] GHC optimisations

2007-08-19 Thread Andrew Coppin
Does GHC do stuff like converting (2*) into (shift 1) or converting x + x into 2*x? If I do x * sin 12, is GHC likely to compute sin 12 at compile-time? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] GHC optimisations

2007-08-20 Thread Andrew Coppin
Stefan O'Rear wrote: On Sun, Aug 19, 2007 at 12:53:07PM +0100, Andrew Coppin wrote: Does GHC do stuff like converting (2*) into (shift 1) or converting x + x into 2*x? For a good time, compile some code which uses even or odd :: Int - Bool using -O2 -fasm -ddump-asm... The compiler

Re: [Haskell-cafe] Newbie question: Where is StackOverflow on the Wiki?

2007-08-21 Thread Andrew Coppin
Stefan O'Rear wrote: sum = sum' 0 sum' k [] = k sum' k (x:xs) = (sum' $! (k+x)) xs enum x y | x = y= 0 | otherwise = x : enum (x+1) y sum (enum 1 10) = sum' 0 (enum 1 10) = sum' 0 (1 : enum (1+1) 10) = (sum' $! (0+1)) (enum (1+1) 10) = sum' 1

Re: [Haskell-cafe] GHC optimisations

2007-08-21 Thread Andrew Coppin
Simon Peyton-Jones wrote: GHC does some constant folding, but little by way of strength reduction, or using shifts instead of multiplication. It's pretty easy to add more: it's all done in a single module. Look at primOpRules in the module PrelRules. Patches welcome! But please also supply

Re: [Haskell-cafe] #haskell irc channel reaches 400 users

2007-08-21 Thread Andrew Coppin
Donald Bruce Stewart wrote: This puts the channel at around the 13th largest community of the 5500 freenode channels. For comparision, a sample of the state of the other language communities: #php 485 #perl472 ##c++457 ##c 445 #python

Re: [Haskell-cafe] Dynamic thread management?

2007-08-21 Thread Andrew Coppin
Tim Chevalier wrote: Anyone can submit a paper to a CS journal or conference. While most people who do so are affiliated with universities, research labs, or (more rarely) non-research companies, there are independent researchers out there, and sometimes you'll notice a paper where someone is

Re: [Haskell-cafe] Re: Newbie question: Where is StackOverflow on the Wiki?

2007-08-21 Thread Andrew Coppin
Neil Mitchell wrote: Hi (I need to find some way to automate making these trails :) ) Yes! We'd need such an automatic tool for the wikibook, too. The problem is that Haskell is ridiculously complex, and the small step interpretation is much harder than you'd think. For

Re: [Haskell-cafe] GHC optimisations

2007-08-22 Thread Andrew Coppin
Neil Mitchell wrote: If Num obeys ring axioms, fromInteger is a perfectly fine ring-homomorphism. (It's also the first or second homomorphism taught.) Does Int obey these axioms? I'm thinking that assuming properties about things such as numbers is very likely to go wrong very quickly.

[Haskell-cafe] Re: Graph reduction [Was: Where is StackOverflow on the Wiki?]

2007-08-23 Thread Andrew Coppin
apfelmus wrote: Yeah, the precise details may vary, even :) But for teaching, an automatic tool that does graph reduction would be great. I don't mind if it's sloppy (directly apply definitions pattern matching VS everything is a lambda abstraction) and only does simply typed lambda calculus

Re: [Haskell-cafe] Re: Graph reduction [Was: Where is StackOverflow on the Wiki?]

2007-08-24 Thread Andrew Coppin
Shiqi Cao wrote: Check out this http://www.cas.mcmaster.ca/~kahl/HOPS/ http://www.cas.mcmaster.ca/%7Ekahl/HOPS/ Heh. I was thinking about trying to build something *exactly like* this... OOC, how the heck did they make it work through a document interface? Surely that's impossible?

Re: [Haskell-cafe] Ideas

2007-08-25 Thread Andrew Coppin
Neil Mitchell wrote: - A wiki program. (Ditto.) Flippi (google: Haskell Flippi) ...and yet haskell.org uses WikiMedia? (Which is written in something bizzare like Perl...) - A general CMS. Hope Woo! I'll have to go play with this for a while... - An interactive

Re: [Haskell-cafe] Ideas

2007-08-25 Thread Andrew Coppin
Bertram Felgenhauer wrote: Hi, You wrote: - An interactive function plotter. (GNUplot is nice, but it can't plot recursive functions...) Actually you can express a lot of those with the ?: operator. Ooo... interesting. I don't recall seeing *that* in the manual! gnuplot f(x) =

[Haskell-cafe] Parsec is being weird at me

2007-08-25 Thread Andrew Coppin
Anybody want to explain to me why this doesn't work? ___ ___ _ / _ \ /\ /\/ __(_) / /_\// /_/ / / | | GHC Interactive, version 6.6.1, for Haskell 98. / /_\\/ __ / /___| | http://www.haskell.org/ghc/ \/\/ /_/\/|_| Type :? for help. Loading package base ...

Re: [Haskell-cafe] Ideas

2007-08-25 Thread Andrew Coppin
Neil Mitchell wrote: HI Flippi (google: Haskell Flippi) ...and yet haskell.org uses WikiMedia? (Which is written in something bizzare like Perl...) Yes, but WikiMedia is a result of years of work, Flippi is a lot less. Wikipedia uses WikiMedia - its a tried and proven

Re: [Haskell-cafe] Ideas

2007-08-25 Thread Andrew Coppin
Philippa Cowderoy wrote: Flippi is... rather minimalistic. And fugly. You can tell it was written by someone who has trouble getting things done! I get the impression it did a certain amount of good as a proof of concept and a reminder that doing things the old-fashioned way still works

Re: [Haskell-cafe] Ideas

2007-08-25 Thread Andrew Coppin
Philippa Cowderoy wrote: I have some (very expensive) software called Reaktor. You draw boxes and lines, it does DSP algorithms. You build synthesizers and effects boxes with it. That sounds exactly like PureData - you can also do graphics as well with PureData, the demo I saw was very

Re: [Haskell-cafe] Ideas

2007-08-25 Thread Andrew Coppin
C.M.Brown wrote: - A graphical programming tool. (You add boxes and put in lines, it constructs a program that you can run.) I'm not entirely exactly sure what you mean by this. I wasn't especially specific about it, that's true enough. I actually had several different things in

Re: [Haskell-cafe] Ideas

2007-08-25 Thread Andrew Coppin
Brandon S. Allbery KF8NH wrote: On Aug 25, 2007, at 14:43 , Andrew Coppin wrote: Yes, but WikiMedia is a result of years of work, Flippi is a lot less. Wikipedia uses WikiMedia - its a tried and proven solution. Well, I guess... I just thought, you know, the Tcl wiki is written in Tcl

Re: [Haskell-cafe] Ideas

2007-08-25 Thread Andrew Coppin
Iain Lane wrote: - Blogging software. (Because there isn't enough of it in the world yet.) In addition (because a little competition can't help ;), I'm going to be experimenting with writing a blog engine for my final year project at Uni next year - 2007/08. Hopefully some good will come

Re: [Haskell-cafe] Ideas

2007-08-25 Thread Andrew Coppin
Stefan O'Rear wrote: On Sat, Aug 25, 2007 at 07:43:30PM +0100, Andrew Coppin wrote: Hey, aren't we trying to tell people is a *useful* language that people should learn and use? ;-) Actually, we aren't. You might not have been able to tell, but a core goal of our community is to stay

[Haskell-cafe] Re: Parsec is being weird at me

2007-08-25 Thread Andrew Coppin
ChrisK wrote: Andrew Coppin wrote: Anybody want to explain to me why this doesn't work? ___ ___ _ / _ \ /\ /\/ __(_) / /_\// /_/ / / | | GHC Interactive, version 6.6.1, for Haskell 98. / /_\\/ __ / /___| | http://www.haskell.org/ghc/ \/\/ /_/\/|_| Type

Re: [Haskell-cafe] Ideas

2007-08-25 Thread Andrew Coppin
Andrew Coppin wrote: C.M.Brown wrote: If you mean one can create programs by creating them visually then perhaps you could consider Vital: http://www.cs.kent.ac.uk/projects/vital/ It's a document-centered implementation of Haskell. Allowing one to display and directly manipulate Haskell

Re: [Haskell-cafe] Ideas

2007-08-25 Thread Andrew Coppin
Peter Verswyvelen wrote: I tried vital, and at first sight it is very nice, but they only support a very limited subset of Haskell, perform no type checking at all, don't support the indent rule, etc... Anyway it is an amazing piece of work. Regarding your question about visual programming, GEM

Re: [Haskell-cafe] Ideas

2007-08-25 Thread Andrew Coppin
Evan Laforge wrote: To get this back to haskell, at the time I wondered if a more natural implementation might be possible in haskell, seeing as it was more naturally lazy. Not sure how to implement the behaviours though (which were simply macros around a let of *dynamic-something*). I'm sure

Re: [Haskell-cafe] Re: Parsec is being weird at me

2007-08-25 Thread Andrew Coppin
Stefan O'Rear wrote: On Sat, Aug 25, 2007 at 08:18:29PM +0100, Andrew Coppin wrote: But hang on a minute... many parses 0 or more occurrances of an item. sepBy parses 0 or more occurrances of an item, seperated by another item. endBy parses 0 or more occurrances of an item, terminated

Re: [Haskell-cafe] Ideas

2007-08-26 Thread Andrew Coppin
Evan Laforge wrote: Indeed, you can write certain DSP algorithms beautifully in Haskell. Now, if only it could talk to the audio hardware... (Or just use common file formats even.) Oh, that's easy. I wrote an FFI interface to portaudio a while back to write a delay-looping type utility

Re: [Haskell-cafe] Re: Parsec is being weird at me

2007-08-26 Thread Andrew Coppin
Chris Casinghino wrote: On 8/25/07, Andrew Coppin [EMAIL PROTECTED] wrote: I thought the whole *purpose* of the endBy combinator was to keep applying one parser until the other one succeeds? I don't think this is a lookahead problem, but rather just a misreading of the spec of endBy

Re: [Haskell-cafe] Re: Parsec is being weird at me

2007-08-26 Thread Andrew Coppin
Chris Casinghino wrote: On 8/25/07, Chris Casinghino [EMAIL PROTECTED] wrote: I'm not sure there is a built in combinator for what you want, I guess I should have looked harder. What you want is manyTill: manyTill :: GenParser tok st a - GenParser tok st end - GenParser tok st [a]

Re: [Haskell-cafe] :, infix operator, infix constructor, et cetera

2007-08-26 Thread Andrew Coppin
Isaac Dupree wrote: Andrew Coppin wrote: Daniel C. Bastos wrote: But that won't compile, because it doesn't obey the syntax rules of Haskell. You could, however, write data List x = x : (List x) | End and it would work. 1 : (2 : (3 : End)) Except that (for no particularly good reason

Re: [Haskell-cafe] Re: Parsec is being weird at me

2007-08-26 Thread Andrew Coppin
Chris Casinghino wrote: On 8/26/07, Andrew Coppin [EMAIL PROTECTED] wrote: ...so then what does sepEndBy do? With endBy, the sequence must end with the separator, with sepEndBy, the final occurrence of the separator is optional. Oh. I see... *sigh* Another wetware error

[Haskell-cafe] Wildly off-topic

2007-08-28 Thread Andrew Coppin
http://importantshock.wordpress.com/2007/08/21/haskell-curry-yes-i-dated-his-daughter/ (Actually, you hardly need to click that. The URL says it all...) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] let and fixed point operator

2007-08-30 Thread Andrew Coppin
OK, so it's only tangentally related, but... do you have *any idea* how many times I've written something like let x = (some complex function of x) in (some other complex function of x) when in fact what I *meant* to do was type x' instead of x?! It's really maddening to write 50,000 lines

Re: [Haskell-cafe] let and fixed point operator

2007-08-30 Thread Andrew Coppin
Brent Yorgey wrote: It's really maddening to write 50,000 lines of code, eventually get it to compile, run it, and have the program lock up and start consuming so much virtual memory that the entire PC becomes unstable within seconds. (This isn't helped by the fact

Re: [Haskell-cafe] let and fixed point operator

2007-08-30 Thread Andrew Coppin
David Roundy wrote: On Thu, Aug 30, 2007 at 06:16:12PM +0100, Andrew Coppin wrote: Obviously you might very well have *meant* to write x = f x. But would it be possible to add some kind of optional compiler warning to find such assignments? It can be a nightmare trying to track down where

Re: [Haskell-cafe] let and fixed point operator

2007-08-30 Thread Andrew Coppin
Dan Piponi wrote: On 8/30/07, Andrew Coppin [EMAIL PROTECTED] wrote: Obviously you might very well have *meant* to write x = f x. But would it be possible to add some kind of optional compiler warning to find such assignments? The thing that convinced me to learn Haskell in the first

Re: [Haskell-cafe] let and fixed point operator

2007-08-31 Thread Andrew Coppin
[EMAIL PROTECTED] wrote: Anyway, I believe strongly that ALL people who have problems with the Haskell protocole, and they are numerous, I teach a good sample of them, should be encouraged to learn Prolog. IN DEPTH, and I mean it, Andrew Coppin and Peter Hercek ! In Prolog A=B is the unification

Re: [Haskell-cafe] let and fixed point operator

2007-08-31 Thread Andrew Coppin
Paul Hudak wrote: ok wrote: What is so bad about f x = g x'' where x'' = x' + transform x' = x * scale (if you really hate inventing temporary names, that is). There's nothing at all wrong with this, assuming it's what you meant to type :-), and it might even

Re: [Haskell-cafe] Learn Prolog...

2007-09-02 Thread Andrew Coppin
the comments of Andrew Coppin. Which arbitrary set of conclusions?? Which patently obvious results not derivable?? Be kind, give some examples, otherwise people may suspect that you are issuing vacuous statements... Read my whole message. What I was saying (in essence) is that Prolog seemed

Re: [Haskell-cafe] Learn Prolog...

2007-09-02 Thread Andrew Coppin
[EMAIL PROTECTED] wrote: Andrew Coppin writes: Ever tried implementing Haskell in Haskell? ;-) Seriously: Haskell is a *complicated* language, needing a parser, which by itself is a non-trivial exercice. It looks so simple on the surface... [Actually, so does cold fusion.] Read my whole

Re: [Haskell-cafe] Elevator pitch for Haskell.

2007-09-08 Thread Andrew Coppin
Dan Weston wrote: WARNING: Learning Haskell is dangerous to your health! Though cut with syntactic sugar to be more palatable to newbies, each Haskell construct is in fact a contagious mix of higher-order functions, lambda expressions, and partial applications, a highly addictive gateway

Re: [Haskell-cafe] Elevator pitch for Haskell.

2007-09-08 Thread Andrew Coppin
Michael Vanier wrote: Awesome! I'm reminded of the IRC post that said that Haskell is bad, it makes you hate other languages. How true it is... I've often thought about a sort of elevator pitch for Haskell. However, every time I sit down to think about this, I come to the same conclusion:

Re: [Haskell-cafe] Elevator pitch for Haskell.

2007-09-08 Thread Andrew Coppin
Neil Mitchell wrote: * Read and write standard binary file formats. (Images, compressed files, etc.) Data.Binary is the low level frameworks, now people can pick up the rest. Last time I checked, there's about half a dozen binary packages. All incompatible. All with different

Re: [Haskell-cafe] Elevator pitch for Haskell.

2007-09-08 Thread Andrew Coppin
Stefan O'Rear wrote: I'd like to add that, until very recently, Haskell wasn't even *trying* to be ready for prime time. It takes an athlete many years to get from the cradle to the finish line, but that's not how we score them! Ah yes - avoid success at all costs. Pitty... I really love

[Haskell-cafe] Tiny documentation request

2007-09-09 Thread Andrew Coppin
I have the following page bookmarked: http://haskell.org/ghc/docs/latest/html/libraries/ I'd like to ask 2 things. 1. Would it be possible to make the *huge* list of package names at the top collapsable? (That way I don't have to scroll through several pages of uninteresting text to get to

Re: [Haskell-cafe] Tiny documentation request

2007-09-09 Thread Andrew Coppin
Sven Panne wrote: On Sunday 09 September 2007 16:40, Andrew Coppin wrote: 1. Would it be possible to make the *huge* list of package names at the top collapsable? (That way I don't have to scroll through several pages of uninteresting text to get to the bit I actually want.) What do

Re: [Haskell-cafe] Where would I find fromInt?

2007-09-10 Thread Andrew Coppin
Albert Y. C. Lai wrote: To the tune of the theme song of Ghostbusters: You've got an Int But you want Double Who do you call? fromIntegral! Let it never, *never* be said that math nerds don't have humour... ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] zip, map and zipWith for arrays

2007-09-10 Thread Andrew Coppin
ok wrote: On 9 Sep 2007, at 10:05 pm, Axel Gerstenberger wrote: I am used to work with map, zip and zipWith, when working with lists, however, I could not find such functions for Arrays. They aren't there for at least two reasons. (1) They are easy to implement on top of the operations that

Re: [Haskell-cafe] Tiny documentation request

2007-09-10 Thread Andrew Coppin
Sven Panne wrote: On Sunday 09 September 2007 18:41, Andrew Coppin wrote: Oh goodie... So it's there to keep the machines happy? No, it's there to keep *me* happy when I'm looking for a module. ;-) Well, there's over 200 modules relating to graph theory alone. (Modules that I

Re: [Haskell-cafe] Tiny documentation request

2007-09-10 Thread Andrew Coppin
Brent Yorgey wrote: And if you use Firefox, you can even install Hoogle as one of the search engines in the upper-right search box. Nice and fast! I've never really understood what the benefit of this is... I mean, Google make the Google toolbar, but what's the point? Why not just click on

Re: [Haskell-cafe] Data.Binary Endianness

2007-09-10 Thread Andrew Coppin
Don Stewart wrote: sven.panne: Of course I can *implement* everything on top of this, but this is not the point. The binary library should have builtin support for more data types, and this is probably not hard to implement. Yeah, just send patches against the darcs repo for either

Re: [Haskell-cafe] Functional dependencies conflict between instance declarations

2007-09-10 Thread Andrew Coppin
Peter Verswyvelen wrote: Never mind, that GHC compiler was again more clever than me, sigh. That's really frustrating about Haskell: the compiler captures so many errors at compile time, that newbies hardly get anything done, it's a constant battle against the errors. But once it compiles, it

Re: [Haskell-cafe] Tiny documentation request

2007-09-10 Thread Andrew Coppin
Neil Mitchell wrote: Hi re: Hoogle not always getting it exactly right, there are a few known bugs floating around which I'm working on. Hoogle can permute the order of arguments though, so that shouldn't be a problem. It doesn't really like Monads, but I wrote Hoogle before I was aware of

Re: [Haskell-cafe] Data.Binary Endianness

2007-09-11 Thread Andrew Coppin
Don Stewart wrote: Just in case people didn't see, the `binary' package lives on http://darcs.haskell.org/binary/ However, Lennart Kolmodin, Duncan and I are actively maintaining and reviewing patches, so send them to one (or all) of us for review. Right. And this is the real

Re: [Haskell-cafe] Can somebody give any advice for beginners?

2007-09-11 Thread Andrew Coppin
Dougal Stanton wrote: On 11/09/2007, Peter Verswyvelen [EMAIL PROTECTED] wrote: To me, Haskell was a bit like climbing a mountain which is largely covered by fog; you don't see anything until you've climbed high enough, and then the view is really beautiful ;-) Either that or: the

Re: [Haskell-cafe] Re: Is take behaving correctly?

2007-09-12 Thread Andrew Coppin
PR Stanley wrote: Hi The same should apply to head and tail. head or tail of [] should be []. What does the list think? Disagree, strongly. Its not even possible for head, since [a] - a. Wadler's theorems for free states that if head is given an empty list the _only_ thing it can do is

Re: [Haskell-cafe] Re: Functional dependencies conflict between instance declarations

2007-09-12 Thread Andrew Coppin
[EMAIL PROTECTED] wrote: Are you kidding, or has automatic proving of programs evolved that far? Aaarrrggg, soon we're all out of job ;-) Experts have been proclaiming this since high-level programming was invented many decades ago. We're still waiting. ;-)

Re: [Haskell-cafe] Re: Is take behaving correctly?

2007-09-13 Thread Andrew Coppin
Jules Bean wrote: I'm not delighted with the idea of replacing our concise elegant standard library names with uglyAndRatherLongCamelCaseNamesThatCouldBePerlOrEvenJava though. Conciseness of expression is a virtue. I, on the other hand, I'm not delighted with names such as Eq and Ord.

Re: [Haskell-cafe] Building production stable software in Haskell

2007-09-17 Thread Andrew Coppin
Adrian Hey wrote: Personally I don't really like the idea of Data.Map, Data.Map.AVL or any other lib becoming entrenched as official or de-facto standards. It seems like a recipe for stagnation to me. IMHO such libs just shouldn't be bundled with ghc (or any other compiler) for this reason.

Re: [Haskell-cafe] Building production stable software in Haskell

2007-09-17 Thread Andrew Coppin
[EMAIL PROTECTED] wrote: Andrew Coppin writes: Out of curiosity... what's so bad about stagnation? (Otherwise known as having a fixed structure that everybody can rely on...) Oh come on, you know the answer, do you like provocations? Shall I remind how many people are unhappy e.g

Re: [Haskell-cafe] what is f=f (not) doing ?

2007-09-23 Thread Andrew Coppin
Peter Verswyvelen wrote: http://www.haskell.org/ghc/docs/2.10/users_guide/user_146.html http://www.haskell.org/ghc/docs/2.10/users_guide/user_146.htmlseems to confirm that? Ouch. Would it be possible to somehow prevent this behavious? (E.g., by somehow annotating each black hole with

Re: [Haskell-cafe] Noob question and sequence of operations (print then do something else)

2007-09-24 Thread Andrew Coppin
John Wicket wrote: Sorry, I was actually trying to use this as an example for something more complicated I am trying to do. In this example, why would the inferred type be IO () aa :: String - String aa instr = do putStrLn abc putStrLn abc return Az Couldn't match expected type

[Haskell-cafe] Complexity question

2007-09-24 Thread Andrew Coppin
Greetings. Anybody happen to know what the time complexity of transpose is? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Complexity question

2007-09-24 Thread Andrew Coppin
Matthew Brecknell wrote: Andrew Coppin: Anybody happen to know what the time complexity of transpose is? Bas van Dijk: The worst case time complexity is O(r*c) where 'r' are the number of rows and 'c' are the number of columns. I believe Bas is correct, though it might

Re: [Haskell-cafe] Shouldnt this be lazy too?

2007-09-24 Thread Andrew Coppin
Vimal wrote: Hi all, I was surprised to find out that the following piece of code: length [1..] 10 isnt lazily evaluated! I wouldnt expect this to be a bug, but in this case, shouldnt the computation end when the length function evaluation goes something like: 10 + length

Re: [Haskell-cafe] Shouldnt this be lazy too?

2007-09-24 Thread Andrew Coppin
Jonathan Cast wrote: On Mon, 2007-09-24 at 17:35 +0100, Andrew Coppin wrote: In an ideal world, yes. In this world, use length (take 11 [1..]) 10... not (null (drop 10 [1..])) is surely faster (not tested...) Faster? There might be a few microseconds in it. Clearer

Re: [Haskell-cafe] Shouldnt this be lazy too?

2007-09-24 Thread Andrew Coppin
Neil Mitchell wrote: Hi lengthNat [1..] 10 Couldn't be clearer, and can be made to work perfectly. If anyone does want to pick up the lazy naturals work, I can send over the code (or write it yourself - its not hard!) Um... isn't a lazy natural just a list with no data, where the list

Re: [Haskell-cafe] Shouldnt this be lazy too?

2007-09-24 Thread Andrew Coppin
Neil Mitchell wrote: Hi Um... isn't a lazy natural just a list with no data, where the list length encodes a number? Pretty much, yes. So I just need to write newtype LazyNatural = LazyNatural [()] and then add some suitable instances. ;-) (Woah... that's one bizzare-looking

Re: [Haskell-cafe] Shouldnt this be lazy too?

2007-09-24 Thread Andrew Coppin
Neil Mitchell wrote: Hi Pretty much, yes. So I just need to write newtype LazyNatural = LazyNatural [()] or data Nat = Zero | Succ Nat it's your choice really. I'm guessing there's going to be fairly minimal performance difference. (Or maybe there is. My way uses

[Haskell-cafe] Very crazy

2007-09-25 Thread Andrew Coppin
While using Haskell, I often find myself writing convoluted constructions such as this: show_system = unlines . zipWith (\l ms - Eq ++ show l ++ : ++ (concat $ intersperse + $ zipWith (\n x - x ++ x ++ show n) [1..] (init ms)) ++ = ++ last ms )

Re: [Haskell-cafe] Very crazy

2007-09-25 Thread Andrew Coppin
Neil Mitchell wrote: Hi And people complain that *Perl* is bad? This function is quite obviously absurd. I mean, it works, but can *you* figure out what it does without running it? No. Can you say what the intention of this code is? Maybe a few examples? The type signature? That way

Re: [Haskell-cafe] Very crazy

2007-09-25 Thread Andrew Coppin
Neil Mitchell wrote: Hi A nice auxiliary would help: showEqn :: Int - [Double] - String showEqn i vs = ... where (add,ans) = (init vs, last vs) Then you can half the complexity. There are probably a few useful functions that aren't in the standard libraries (consperse, joinWith

Re: [Haskell-cafe] Very crazy

2007-09-25 Thread Andrew Coppin
Dougal Stanton wrote: In this instance I would suggest: (1) Text.Printf You've got to be kidding... I went to all the trouble of learning a scary logic programming language [sic] just to avoid that damned printf() function! :-/ (2) Pull out some of those things into separate functions

Re: [Haskell-cafe] Very crazy

2007-09-25 Thread Andrew Coppin
Tristan Allwood wrote: Just to follow those sentiments, the version I knocked out quickly looked like: (It's not quite the same as the original function, I think I'm lacking a map (map (take 8)) on the first line). showSystems :: Show a = [[a]] - String showSystems = unlines . zipWith

Re: [Haskell-cafe] Very crazy

2007-09-25 Thread Andrew Coppin
Brandon S. Allbery KF8NH wrote: On Sep 25, 2007, at 5:48 , Andrew Coppin wrote: You've got to be kidding... I went to all the trouble of learning a scary logic programming language [sic] just to avoid that damned printf() function! :-/ Enh. :) On the other hand, I do wonder that nobody's

Re: [Haskell-cafe] Re: Very crazy

2007-09-25 Thread Andrew Coppin
Aaron Denney wrote: On 2007-09-25, Andrew Coppin [EMAIL PROTECTED] wrote: BTW, one *extremely* common function that I've never seen mentioned anywhere is this one: map2 :: (a - b) - [[a]] - [[b]] map2 f = map (map f) Because someone would have to think of a name for it, when

Re: [Haskell-cafe] Very crazy

2007-09-25 Thread Andrew Coppin
Brandon S. Allbery KF8NH wrote: On Sep 25, 2007, at 5:56 , Andrew Coppin wrote: More seriously, I have no idea how you'd implement this in Haskell. Presumably the standard show instance for Int, Double, etc. is in native C? You could probably reimplement it in Haskell for the integer case

Re: [Haskell-cafe] Re: Very crazy

2007-09-25 Thread Andrew Coppin
Aaron Denney wrote: On 2007-09-25, Andrew Coppin [EMAIL PROTECTED] wrote: OK, *now* I'm puzzled... Why does map . map type-check? (map . map) = (.) map map (.) :: (a - b) - (b - c) - a - c = (a - b) - (b - c) - (a - c) The first two arguments of (.) are 1-argument functions

Re: [Haskell-cafe] Re: Very crazy

2007-09-25 Thread Andrew Coppin
Chaddaï Fouché wrote: 2007/9/25, Andrew Coppin [EMAIL PROTECTED]: I just found it rather surprising. Every time *I* try to compose with functions of more than 1 argument, the type checker complains. There is no function that takes more than one argument in Haskell. ;-) map _could_

Re: [Haskell-cafe] Very crazy

2007-09-25 Thread Andrew Coppin
Chaddaï Fouché wrote: 2007/9/25, Andrew Coppin [EMAIL PROTECTED]: Forget PrintfType - I can't even understand the haddoc page yet! (printf performs I/O, yet it is outside the I/O monad. It seems to accept an arbitrary number of arguments, which is obviously impossible. It's *almost

Re: [Haskell-cafe] Re: Very crazy

2007-09-25 Thread Andrew Coppin
Chaddaï Fouché wrote: 2007/9/25, Andrew Coppin [EMAIL PROTECTED]: This is why I found it so surprising - and annoying - that you can't use a 2-argument function in a point-free expression. For example, zipWith (*) expects two arguments, and yet sum . zipWith (*) fails to type-check. You

Re: [Haskell-cafe] Very crazy

2007-09-25 Thread Andrew Coppin
Chaddaï Fouché wrote: 2007/9/25, Andrew Coppin [EMAIL PROTECTED]: printf don't always perform IO : if you ask it for a String it will happily turn into sprintf for you, if you use it in the IO Monad, it will indeed perform IO, but there's nothing fundamentally IO bound in printf logic

Re: [Haskell-cafe] Re: Very crazy

2007-09-25 Thread Andrew Coppin
Martin Lütke wrote: Dominic Steinitz schrieb: Look at the type of (.).(.) which should tell you how to compose functions with more than one variable. Mind you, I don't think it improves readability. Dominic. Interesting function. It got a sibling: (.)(.) :: (a1 - b - c) - a1 - (a -

Re: [Haskell-cafe] Haskell Cheat Sheet?

2007-09-25 Thread Andrew Coppin
brad clawsie wrote: nice that it is in html. the pdf thing seems a bit contrived to me. Clearly you've never tried printing hard copies of HTML. ;-) Personally, I think having *both* is a nice idea. You can browse around the HTML, or you can print out hard copies to sit next to your

Re: [Haskell-cafe] Assignment, Substitution or what?

2007-10-01 Thread Andrew Coppin
PR Stanley wrote: Hi f x = x + x Is the x use to create a pattern in the definition and when f is called it's replaced by a value? Basically, uh, yeah. If you say f 5, this is basically equivilent to 5 + 5 by the above definition. (I'm sure a huge number of others will chime in on this

[Haskell-cafe] GHC doesn't work

2007-10-03 Thread Andrew Coppin
Greetings. I have a PC that had GHC 6.6 running on it. Worked fine. Then I uninstalled 6.6 and installed 6.6.1, and now it doesn't appear to work at all. Any attempt to run GHC results in a message that says The entry point OpenThread could not be found in KERNEL32.dll. or something very

Re: [Haskell-cafe] GHC doesn't work

2007-10-04 Thread Andrew Coppin
Salvatore Insalaco wrote: 2007/10/3, Andrew Coppin [EMAIL PROTECTED]: The entry point OpenThread could not be found in KERNEL32.dll. Are you using NT 4? Affirmative. Windows NT 4.0 Service Pack 6a. Probably GHC 6.6.1 dropped support for it (or maybe the binary you downloaded

Re: [Haskell-cafe] New slogan for haskell.org

2007-10-05 Thread Andrew Coppin
Bayley, Alistair wrote: Well, wouldn't it be best to define your audience first? At the risk of alienating Pythonistas... The Python home page is very much snake oil (as Albert points out). But it appears that they're aiming squarely at the average gormless C/C++/VB/Java drone who's heard a bit

Re: [Haskell-cafe] New slogan for haskell.org

2007-10-05 Thread Andrew Coppin
Henning Thielemann wrote: If this would be true, they would have switched to Modula II quickly ... I know that C programmers also like the concise/cryptic/inconsistent syntax. It seems to me more than C programmers like to think they're cleaver because they can spend weeks building elaborate

[Haskell-cafe] Type-level arithmetic

2007-10-06 Thread Andrew Coppin
I've seen quite a few people do crazy things to abuse the Haskell type system in order to perform arithmetic in types. Stuff the type system was never ever intended to do. Well I was just wondering... did anybody ever sit down and come up with a type system that *is* designed for this kind of

Re: [Haskell-cafe] ANNOUNCE: binary 0.4: high performance, pure binary parsing and serialisation

2007-10-06 Thread Andrew Coppin
Don Stewart wrote: *Very* high performance can be expected, with throughput over 1G/sec observed in practice (good enough for most networking scenarios, we suspect). Um... I wasn't aware that there was any harddrive or networking technology that goes this fast? Anyway, I'll have to take

Re: [Haskell-cafe] Re: pi

2007-10-10 Thread Andrew Coppin
Henning Thielemann wrote: It would better to disallow negative bases completely for (**), because integers should be explicitly typed as integers and then (^^) can be used. I have already seen (x**2) and (e ** x) with (e = exp 1) in a Haskell library. Even better would be support for

Re: [Haskell-cafe] New slogan for haskell.org

2007-10-10 Thread Andrew Coppin
Seth Gordon wrote: Aha! Instead of the lambda surrounded by mathematical stuff as the haskell.org logo, we need a picture of a medicine bottle. Haskell. Fewer headaches. No side effects. Alternatively, a picture of a red pill with an embossed lambda... I can hear millions of CS

Re: [Haskell-cafe] New slogan for haskell.org

2007-10-10 Thread Andrew Coppin
Henning Thielemann wrote: On Mon, 8 Oct 2007, Alistair Bayley wrote: On 08/10/2007, Henning Thielemann [EMAIL PROTECTED] wrote: You cannot turn any programmer into a disciplined programmer just by giving him a well designed language. I you try so, they will not like to use that language,

Re: [Haskell-cafe] New slogan for haskell.org

2007-10-10 Thread Andrew Coppin
Derek Elkins wrote: On Mon, 2007-10-08 at 20:54 +1000, Thomas Conway wrote: I must say, I get that! but at the same time, of course, the high level abstraction is exactly what *we* love about Haskell. Then they should teach assembly not Python. In fact, I'd recommend assembly anyway.

Re: [Haskell-cafe] New slogan for haskell.org

2007-10-10 Thread Andrew Coppin
How about we just steal the BBC's slogan? Where different works ;-) Say what you like about Haskell, but it is undeniably very different to mainstream programming languages. This in itself is a potential advantage (and problem). ___ Haskell-Cafe

  1   2   3   4   5   6   7   8   9   10   >