Re: [Haskell-cafe] Dynamic thread management?

2007-08-21 Thread Hugh Perkins
On 8/11/07, Neil Bartlett [EMAIL PROTECTED] wrote: You're absolutely right that a dynamic/adaptive approach is the only one that will work when the tasks are of unknown size. Whether this approach is as easy as you think is open for you to prove. I look forward to testing your VM

Re: [Haskell-cafe] Dynamic thread management?

2007-08-21 Thread Hugh Perkins
On 8/21/07, Tim Chevalier [EMAIL PROTECTED] wrote: I don't think you have to worry too much about the political obstacles. People want automatic multithreading, and in a year or two we'll all have multicore boxen. In any case, if you don't solve the technical problems, the political ones will

Re: [Haskell-cafe] Re: Bi-directional Maps

2007-08-21 Thread Hugh Perkins
Exactly. For this to work there needs to be the constraint that there's a one-to-one mapping in each direction. The Bimap should have the uniqueness promise that Set (k, v) gives. Yet you should be able to search on either tuple value. Or... have the possibility of returning a list of values.

Re: [Haskell-cafe] GHC optimisations

2007-08-21 Thread Hugh Perkins
On 8/21/07, Stefan O'Rear [EMAIL PROTECTED] wrote: Currently, it's never worse. GHC's backend is about as good as GCC; most of the optimiations it doesn't do are not possible for GCC because of various lack-of-information problems (the stack pointer never aliases the heap pointer, stuff like

Re: [Haskell-cafe] Dynamic thread management?

2007-08-21 Thread Hugh Perkins
On 8/21/07, Andrew Coppin [EMAIL PROTECTED] wrote: I highly doubt that automatic threading will happen any time this decade - but I just learned something worth while from reading this email. ;-) That's an interesting observation. I cant say I dont believe it, but I'm interested to know why

Re: [Haskell-cafe] GHC optimisations

2007-08-21 Thread Hugh Perkins
Thank-you for the information. It was very useful. Couple of reactions FWIW: On 8/21/07, Stefan O'Rear [EMAIL PROTECTED] wrote: Sooo if I was feeling evil, could I take this c-code and pipe it into something that turns it into C#??? Yes. You could do the same with the original

Re: [Haskell-cafe] GHC optimisations

2007-08-22 Thread Hugh Perkins
On 8/22/07, Twan van Laarhoven [EMAIL PROTECTED] wrote: But Double is already quite badly behaved: let x = 1e20 Prelude 1 + (x - x) 1.0 Prelude (1 + x) - x 0.0 E. Whilst that's understandable and unavoidable, that kindof rings alarm bells for folds of Doubles in an automatic

Re: [Haskell-cafe] Dynamic thread management?

2007-08-22 Thread Hugh Perkins
On 8/22/07, Brandon Michael Moore [EMAIL PROTECTED] wrote: Automatic threading is inherently limited by data dependencies. You can't run a function that branches on an argument in parallel with the computation producing that argument. Even with arbitrarily many processors and no communication

Re: [Haskell-cafe] Haskell on the Playstation 3? :-)

2007-08-29 Thread Hugh Perkins
On 8/30/07, Derek Elkins [EMAIL PROTECTED] wrote: Either the language of the graphics card is Turing complete and the answer is yes or the language isn't and the answer is no. Well, a quick google for are graphics cards turing complete? suggests that some nVidia cards are Turing complete, but I

Re: [Haskell-cafe] Haskell on the Playstation 3? :-)

2007-08-30 Thread Hugh Perkins
On 8/30/07, Miguel [EMAIL PROTECTED] wrote: What about running Haskell on a PostScript printer? PostScript IS Turing-complete. Yes, because postscript printers are famous for being really fast ;-) ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Haskell on the Playstation 3? :-)

2007-08-30 Thread Hugh Perkins
Dan Piponi [EMAIL PROTECTED] wrote: http://developer.nvidia.com/object/cuda.html It's a C compiler with multiprocessor streaming extensions that targets nvidia cards. Whoa :-O Cool :-) But it's not that simple... Few things are ;-) Whats the catch? Can we use a graphics-card as an n-core

Re: Re[2]: [Haskell-cafe] Haskell on the Playstation 3? :-)

2007-08-30 Thread Hugh Perkins
So, according to the blurb, and since this is product-specific, I dont know if this is allowed on the newsgroup?, but it does seem to be a fairly unique product? : - this technology works on GeGForce 8800 cards or better - there's a dedicated processing unit available called the Tesla, which is

Re: Re[4]: [Haskell-cafe] Haskell on the Playstation 3? :-)

2007-08-30 Thread Hugh Perkins
On 8/30/07, Bulat Ziganshin [EMAIL PROTECTED] wrote: it's the same as 8800GTX. please read CUDA manual first. these 128 threads are not independent, each 8 or 16 threads execute the same code H, yes you are right. The GPU contains 8 multiprocessors, where each multiprocessor contains

Re: Re[4]: [Haskell-cafe] Haskell on the Playstation 3? :-)

2007-08-30 Thread Hugh Perkins
On 8/31/07, Dan Piponi [EMAIL PROTECTED] wrote: Right. But the functions and data that we are trying to map and fold could be anything, so we are required to have the full functionality of Haskell running on the GPU - unless the compiler can smartly figure out what should run on the GPU and

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

2007-09-01 Thread Hugh Perkins
Cool I had prolog for my Spectrum, many years ago (83?), but I stopped using it when I realized it didnt have any input/output capabilities beyond print, and no way to escape from the prolog bubble, eg FFI (not sure what FFI stands for, but I think it is a way for Haskell to escape into other

Re: [Haskell-cafe] RE: Definition of the Haskell standard library

2007-09-01 Thread Hugh Perkins
A really simple way to track the quality of a package is to display the number of downloads. A posteriorae, this works great in other download sites. We can easily hypothesize about why a download count gives a decent indication of some measure of quality: - more people downloading it means more

Re: [Haskell-cafe] RE: Definition of the Haskell standard library

2007-09-02 Thread Hugh Perkins
On 9/2/07, Sven Panne [EMAIL PROTECTED] wrote: High-qualitiy standard libraries which are packaged with GHC/Hugs/... will probably almost never be downloaded separately. Good point. Note however that if someone is hunting for a library, it's generally because it's not already bundled with

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

2007-09-02 Thread Hugh Perkins
On 9/2/07, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote: in the early 90s I think I found the flaw in your argument ;-) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

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

2007-09-02 Thread Hugh Perkins
Sooo.. what is the modern equivalent of Prolog? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Haskell as an extension language

2007-09-02 Thread Hugh Perkins
Off-topic, so stop reading now if you want ;-) , but reminds me of my experience using Python and C++. Python and C++ are both great languages, with their own strengths, and one might think that combining thing gets the best of both. However, using Swig etc to join Python to C++ takes a

Re: [Haskell-cafe] RE: Definition of the Haskell standard library

2007-09-02 Thread Hugh Perkins
On 9/3/07, Adrian Hey [EMAIL PROTECTED] wrote: The popularity of MS Winders or Office Suite are the obvious examples. We all know why these are used on 95% or whatever of the worlds PCs, and it has nothing whatever to do with quality. Oh come on. You've been reading waaayyy too much

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

2007-09-02 Thread Hugh Perkins
On 9/3/07, Derek Elkins [EMAIL PROTECTED] wrote: Because no one has said it quite this way: The modern equivalent of Prolog is Prolog. Ok, thanks. Just wanted to check that. (btw, just thought, when I was talking about FFI, probably meant Forth, not Prolog. FFI for Prolog probably isnt that

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

2007-09-02 Thread Hugh Perkins
(BTW I thought the FFI for Forth was the Forth assembler; have things changed since FIG/F83?) I didnt have a real PC, just a ZX Spectrum. It wasnt real Forth, just Spectrum Forth. It was kindof fun, but a little disappointing not to be able to do anything useful with it. Well, I wanted to

Re: [Haskell-cafe] Re: Bi-directional Maps

2007-09-02 Thread Hugh Perkins
Just noticed, erlang has the second kind of bimap (a bijection?) built into each process: From http://www.erlang.org/doc/reference_manual/processes.html : 10.9 Process Dictionary Each process has its own process dictionary, accessed by calling the following BIFs: put(Key, Value) get(Key) get()

Re: [Haskell-cafe] RE: Definition of the Haskell standard library

2007-09-03 Thread Hugh Perkins
On 9/3/07, Adrian Hey [EMAIL PROTECTED] wrote: FYI, I am old enough to actually remember life before MS and I can also remember what's happened to the industry at large and to various the organisations I've worked in and had dealings with over the last 25 years or so. Fair enough.

Re: [Haskell-cafe] Haskell as an extension language

2007-09-03 Thread Hugh Perkins
On 9/3/07, Peter Verswyvelen [EMAIL PROTECTED] wrote: Well, then you should take a look at Boo... http://boo.codehaus.org Yes, I've looked at Boo a little. It looks cool. It made me think that a lot of language wars boils down not just to the syntactic sugar that hits one in the face at the

Re: [Haskell-cafe] Dynamic thread management?

2007-09-17 Thread Hugh Perkins
Couple of thoughts/observations: - Erlang has a vm, so that would avoid building a vm. On the downside, erlang is not pure: the message-passing and the io: commands imply the possibility of side-effects. Still, it could be good enough for a proof-of-concept? - implementation as a library

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

2007-09-17 Thread Hugh Perkins
Just out of curiosity, how could one do something like a factory, so that by default a library uses, say, Data.Map, but by making a simple assignment we can switch the library to use a different implementation? (This is alluded to above, but not explicitly stated. I guess it's too easy, but

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

2007-09-17 Thread Hugh Perkins
On 9/18/07, Hugh Perkins [EMAIL PROTECTED] wrote: Just out of curiosity, how could one do something like a factory, so that by default a library uses, say, Data.Map, but by making a simple assignment we can switch the library to use a different implementation? (And of course, the 10 million

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

2007-09-22 Thread Hugh Perkins
Gotta love lazy infinite loops :-D Sounds like something out of a Douglas Adams novel. Ok, this post is totally off-topic... On 9/22/07, Pasqualino 'Titto' Assini [EMAIL PROTECTED] wrote: The funny thing is that, while it is stuck in an infinite loop, GHCi doesn't seem to use any CPU time

Re: [Haskell-cafe] Hugs, dotnet, C#...

2007-10-10 Thread Hugh Perkins
On 10/3/07, Peter Verswyvelen [EMAIL PROTECTED] wrote: I needed to type at least 3 times the amount of code, much of which was boilerplate code, and the code is not elegant. Reflection is your friend here. Example. Code before reflection: MyConfig { // some properties here public

Re: [Haskell-cafe] Hugs, dotnet, C#...

2007-10-10 Thread Hugh Perkins
Have you tried F#? I mean, I havent ;-) but maybe it's an interesting half-way house? Presumably you can use all the standard .Net libraries (maybe good enough for getting asp.net working etc?), and you can still use FP constructs? I understand F# is not pure (I think?), and doesnt have monads,

Re: [Haskell-cafe] On the verge of ... giving up!

2007-10-14 Thread Hugh Perkins
On 10/14/07, Vimal [EMAIL PROTECTED] wrote: Dear Haskellers, I have been trying my best to read about Haskell from the various tutorials available on the internet and blogs. I havent been following YAHT properly, so its always been learning from 'bits and pieces' scattered around. You might

Re: [Haskell-cafe] On the verge of ... giving up!

2007-10-14 Thread Hugh Perkins
You're picking on Andrew Coppin? That's insane. He's got a sense of humour, and he's a lay (non-phd) person. Honestly, in one thread you've got Haskell is misunderstood! Its the greatest language in the world! Why does no-one use it and in another you're insulting one of the few non-phds

Re: [Haskell-cafe] On the verge of ... giving up!

2007-10-14 Thread Hugh Perkins
Correction, I'm also very interested in Haskell, and I even don't have a bachelor degree :-) I'm a completely self-educated kind-a-guy... That's true, and actually you and Andrew are two of the people whose opinions I respect the most. Well, I'll add SPJ to that list I guess. Anyway, IMHO

Re: [Haskell-cafe] Why can't Haskell be faster?

2007-11-01 Thread Hugh Perkins
On 10/31/07, Paulo J. Matos [EMAIL PROTECTED] wrote: Hello all, I, along with some friends, have been looking to Haskell lately. I'm very happy with Haskell as a language, however, a friend sent me the link: http://shootout.alioth.debian.org/gp4/ Careful: it's worse than you think. Many

Re: [Haskell-cafe] Re: Hiding side effects in a data structure

2007-11-01 Thread Hugh Perkins
On 10/26/07, John Meacham [EMAIL PROTECTED] wrote: Heh, the plethora of pdf papers on Haskell is part of what originally brought me to respect it. Something about that metafont painted cmr just makes me giddy as a grad student. A beautifully rendered type inference table is a masterful work of

Re: [Haskell-cafe] Re: Why can't Haskell be faster?

2007-11-03 Thread Hugh Perkins
On Nov 3, 2007 5:00 AM, Ryan Dickie [EMAIL PROTECTED] wrote: Lossless File compression, AKA entropy coding, attempts to maximize the amount of information per bit (or byte) to be as close to the entropy as possible. Basically, gzip is measuring (approximating) the amount of information

Re: [Haskell-cafe] Why purely in haskell?

2008-01-12 Thread Hugh Perkins
On Jan 9, 2008 5:43 PM, Derek Elkins [EMAIL PROTECTED] wrote: A shorter and lighter and and also interesting and entertaining read is: http://research.microsoft.com/~simonpj/Papers/haskell-retrospective/index.htm While the reason Haskell was pure was to support laziness, at this point though

[Haskell-Cafe] Linq (FP in C#)

2008-01-12 Thread Hugh Perkins
Linq went live in C# in November, as part of .Net 3.5. It adds lots of FP-things to C#. It's really fun to be able to use Haskell-ish things in C#. Manipulating lists and collections just got *much* easier. Things it does: - map, fold, filter are all there (they're called select, agregate,

Re: [Haskell-cafe] Solving a geometry problem with Haskell

2008-01-12 Thread Hugh Perkins
On Jan 12, 2008 10:19 PM, Rafael Almeida [EMAIL PROTECTED] wrote: After some profiling I found out that about 94% of the execution time is spent in the ``isPerfectSquare'' function. I guess that Haskell's referential transparence means the answers to the isPerfectSquare will be cached, ie

Re: [Haskell-cafe] [newbie question] Memoization automatic in Haskell?

2008-01-12 Thread Hugh Perkins
On Jan 12, 2008 10:54 PM, Henning Thielemann [EMAIL PROTECTED] wrote: On Sat, 12 Jan 2008, Hugh Perkins wrote: I guess that Haskell's referential transparence means the answers to the isPerfectSquare will be cached, ie automatically memoized? (not sure if is correct term?) http

[Haskell-cafe] Possibilities for website construction using Haskell?

2008-01-13 Thread Hugh Perkins
What are the possibilities for website construction using Haskell? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Possibilities for website construction using Haskell?

2008-01-13 Thread Hugh Perkins
On Jan 13, 2008 8:13 PM, Derek Elkins [EMAIL PROTECTED] wrote: http://www.haskell.org/haskellwiki/Applications_and_libraries/Web_programming Good link. Lots of options apparently :-) I'm sure you can figure it out from here, or at least come back with a more specific question. Which ones

[Haskell-Cafe] Add number of downloads to hackageDB page?

2008-01-13 Thread Hugh Perkins
I seem to remember a thread about this a while back actually, but... Any chance of adding the number of downloads to the hackageDB page? For those packages that are included in ghc, hugs etc, perhaps add a green tick with included in ghc, included in hugs, etc? That way it should be relatively

[Haskell-cafe] XmlSerializer.deserialize?

2007-06-24 Thread Hugh Perkins
Hi, Trying to write a function to deserialize a haskell type from xml. Ideally this wont need a third DTD file, ie it will work something like XmlSerializer.Deserialize from C#: deserializeXml :: Data(a) = String - a serializeXml :: Data(a) = a - String Writing serializeXml is pretty easy:

[Haskell-cafe] Constructing a datatype given just its constructor as a string?

2007-06-24 Thread Hugh Perkins
Trying to create a datatype/constructor given just its constructor as a string, something like: mkConstr :: String - Constr parseData :: (Data a) = String - a ***without knowing in advance anything about the datatype apart from the string contents*** So, not something like: parseData Just 3

Re: [Haskell-cafe] Constructing a datatype given just its constructor as a string?

2007-06-24 Thread Hugh Perkins
Just noticed that all my responses have been going only to Neil, not to the group. Anyway, the jist of our conversation was that it's not possible to create arbitrary datatypes/constructors from strings in Haskell. Can anyone deny/confirm? ___

Re: [Haskell-cafe] XmlSerializer.deserialize?

2007-06-24 Thread Hugh Perkins
Yes, or better: gshow' :: Data a = a - String gshow' t = fromMaybe (showConstr(toConstr t)) (cast t) (which gets rid of the parentheses around numbers). Still doesnt get a deserialize though ;-) On 6/24/07, Andrea Vezzosi [EMAIL PROTECTED] wrote: As a side note i'd like to point out that

Re: [Haskell-cafe] XmlSerializer.deserialize?

2007-06-26 Thread Hugh Perkins
On 6/25/07, Udo Stenzel [EMAIL PROTECTED] wrote: That type signature describes a function that can deliver *anything* (that is in class Data), whatever you ask from it. Yes, that is the goal :-) If you do that, you wind up dragging in all the machinery of Data.Generic Is reflection

Re: [Haskell-cafe] XmlSerializer.deserialize?

2007-06-30 Thread Hugh Perkins
Still struggling with this. If anyone has any constructive ideas? I guess it's not really easy otherwise someone would have come up with a solution by now ;-) The issue is the line in makeConstrM'' where we're trying to read (Data a = a) from (String). read doesnt work, because read needs a

Re: [Haskell-cafe] sha1 implementation thats only 12 times slower then C

2007-07-01 Thread Hugh Perkins
Just an outsider's reaction, and for all I know unsafeRead is actually safe, but if the point of using Haskell (and I'm still trying to discover what that is ;-) ) is either to be able to rigorously mathematically prove that your program will work perfectly (target usage 1), or to carry out

Re: [Haskell-cafe] XmlSerializer.deserialize?

2007-07-01 Thread Hugh Perkins
On 6/26/07, Udo Stenzel [EMAIL PROTECTED] wrote: That's another way of saying that the truly powerful features are missing from C#... Hi Udo, Genuine question: please could you tell me what are the truly powerful features of Haskell? My own personal interest comes from a presentation by

Re: [Haskell-cafe] Parsers are monadic?

2007-07-01 Thread Hugh Perkins
Big Chris wrote: http://www.cs.nott.ac.uk/~gmh/bib.html#monparsing Hey, just to say, the first few pages of this explain monads really well. Good reference :-) It's the first introduction to monads I've seen that describes monads directly, without using analogies, and manages to be both

Re: Re[2]: [Haskell-cafe] XmlSerializer.deserialize?

2007-07-01 Thread Hugh Perkins
Ok good info :-) btw, are you read Hoar's book Communicating Sequential Processes? i think that his model is very FPish and reading his book should allow to switch your look at concurrency in right direction No, I'll check it out. On 7/1/07, Bulat Ziganshin [EMAIL PROTECTED] wrote: Hello

Re: Re[2]: [Haskell-cafe] XmlSerializer.deserialize?

2007-07-01 Thread Hugh Perkins
Well, figured out a solution to parsing xml. It's not really pretty, but it works. Basically we just convert the incoming xml into a gread compatible format then use gread :-D If someone has a more elegant solution, please let me know. module ParseXml where import IO import Char import

Re: Re[2]: [Haskell-cafe] XmlSerializer.deserialize?

2007-07-01 Thread Hugh Perkins
Clll :-) Thanks for the link. Er are you the Philip Armstrong I was at college with ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: Re[2]: [Haskell-cafe] XmlSerializer.deserialize?

2007-07-02 Thread Hugh Perkins
lol small world :-) On 7/2/07, Philip Armstrong [EMAIL PROTECTED] wrote: On Mon, Jul 02, 2007 at 12:23:36AM +0200, Hugh Perkins wrote: Clll :-) Thanks for the link. Er are you the Philip Armstrong I was at college with Shhh. Don't tell everyone or they'll all want one

[Haskell-cafe] Getting debugging/logging info?

2007-07-02 Thread Hugh Perkins
In imperative languages we can do this type of thing: SystemLogging.LogInfo(About to do something...); DoSomething(); SystemLogging.LogInfo(Did Something); SystemLogging.LogInfo(x is + x ); How can we do something similar in Haskell? ___ Haskell-Cafe

[Haskell-cafe] Callback functions?

2007-07-02 Thread Hugh Perkins
This sounds something like using a continuation function. In imperative languages, we might have something like: class MyDisplayForm { void ButtonGo_Press() { Processor.Go( new CallbackDelegate( this.SetStatus ) ); } public void SetStatus( string message ) { StatusLbl.Text

Re: [Haskell-cafe] Very simple parser

2007-07-02 Thread Hugh Perkins
Graham Hutton has some great tutorials on parsing. Check out the Are parsers monodic? thread (not exact name) for a good reference. There's also a good tutorial at http://www.cs.nott.ac.uk/~gmh/book.html In Section Slides, click on 8 Functional parsers, but you may just want to start from 1.

Re: [Haskell-cafe] Getting debugging/logging info?

2007-07-02 Thread Hugh Perkins
On 7/3/07, Neil Mitchell [EMAIL PROTECTED] wrote: See trace: http://www.haskell.org/hoogle/?q=trace I'll check that out. Thanks. Maybe, with System.IO, Fine in main :-) Less good in a 100,000 line application. ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Callback functions?

2007-07-02 Thread Hugh Perkins
: On 7/2/07, Hugh Perkins [EMAIL PROTECTED] wrote: Anyway, so the question is: how do we write callback functions in FP/Haskell? Can someone provide a simple, but functional example? What makes a callback different from any other kind of function? In Haskell, as in other functional programming

Re: [Haskell-cafe] Getting debugging/logging info?

2007-07-03 Thread Hugh Perkins
Ok, I'll play with that. On 7/3/07, Jules Bean [EMAIL PROTECTED] wrote: Hugh Perkins wrote: In imperative languages we can do this type of thing: SystemLogging.LogInfo(About to do something...); DoSomething(); SystemLogging.LogInfo(Did Something); SystemLogging.LogInfo(x is + x

Re: [Haskell-cafe] Trying to make a Typeable instance

2007-07-07 Thread Hugh Perkins
Can you just write: data ListGT map k a = Empt | BraF ![k] a !(map (ListGT map k a)) | BraE ![k] !(map (ListGT map k a)) deriving( Typeable ) ? On 7/7/07, Adrian Hey [EMAIL PROTECTED] wrote: Hello, I'm trying to make the type (ListGT map k a) an instance of Typeable, where map is

Re: [Haskell-cafe] xkcd #287 NP-Complete

2007-07-10 Thread Hugh Perkins
This is a compact solution, but it produces multiple permutations of the same solution, which increases runtime. I let it run for 10 seconds, then ctrl-c'd. Here's a solution that produces all 2 (or three, if you include Barbecue Sandwich) solutions instantly: Output: = *Xkcd287 go Menu 1

Re: [Haskell-cafe] In-place modification

2007-07-10 Thread Hugh Perkins
On 7/8/07, Andrew Coppin [EMAIL PROTECTED] wrote: I was wittering on about stream fusion and how great it is, and I got a message from Mr C++. (Mr C++ develops commercial games, and is obsessed with performance. For him, the only way to achieve the best performance is to have total control

Re: [Haskell-cafe] xkcd #287 NP-Complete

2007-07-10 Thread Hugh Perkins
By the way, if you enjoy these problems, there are tons of these at topcoder.com I cant help thinking it'd be neat to have topcoder-like competitions for Haskell, either by pursuading topcoder to integrate support for Haskell, or hosting our own. ___

Re: [Haskell-cafe] In-place modification

2007-07-10 Thread Hugh Perkins
You're talking to someone who spent his teenage years doing assembler because that's what l33t games developers did, and I wanted to be like them. Sure, you can still find assembler around the place, but even l33t games developers dont use it any more. On 7/10/07, Alex Queiroz [EMAIL PROTECTED]

Re: [Haskell-cafe] In-place modification

2007-07-10 Thread Hugh Perkins
On 7/10/07, Sebastian Sylvan [EMAIL PROTECTED] wrote: While I personally think that the productivity argument should be enough to make the switch, the killer-app (the app that will kill C, that is :-)) is concurrency. C is just not a tractable tool to program highly concurrent programs, unless

Re: [Haskell-cafe] Type system madness

2007-07-10 Thread Hugh Perkins
We can consider three families of character sets: - ASCII: 127 characters, some of which are escape codes like bell etc - regional encodings: china uses GB2312, Europe uses ISO-8859-1, America uses ... something - unicode: UTF-8, UTF-16 The regional encodings are optimized for their region, and

Re: [Haskell-cafe] Looking for final year project - using Haskell, or another functional language

2007-07-10 Thread Hugh Perkins
rpc layer, like .Net Remoting or ICE (but preferably without needing configuration/interface files) Course, if you know what you're doing, that's more like 1 week than one year, but you could do that and then see where it takes you. If you want something really challenging, rewrite OSMP (

Re: [Haskell-cafe] function unique

2007-07-11 Thread Hugh Perkins
Simple answer: you always have to have the single element first, then the list bit second. It's just the way it is. You can learn why later on ;-) On 7/11/07, Alexteslin [EMAIL PROTECTED] wrote: Oh, I am lost now - for now anyway. I am attempting to do next exercise in the book to define

Re: [Haskell-cafe] function unique

2007-07-11 Thread Hugh Perkins
Ok so I played with the tweaked problem (Unix 'uniq'), and getting it to be lazy. This seems to work: testunique :: Eq a = [a] - [a] testunique list = testunique' list [] where testunique' :: Eq a = [a] - [a] - [a] testunique' [] elementssofar = [] testunique' (x:xs)

Re: [Haskell-cafe] function unique

2007-07-11 Thread Hugh Perkins
Oh, lol because I'm stupid and put the arguments the wrong way around in the first recursive call to testunique' ;-) On 7/11/07, Hugh Perkins [EMAIL PROTECTED] wrote: Ok so I played with the tweaked problem (Unix 'uniq'), and getting it to be lazy. This seems to work: testunique :: Eq

Re: [Haskell-cafe] function unique

2007-07-11 Thread Hugh Perkins
) of the second argument. It's pretty hard not to put the right arguments in the right order. Not so in Haskell where I spend insane amounts of time trying to remember what argument is what in a function I wrote 30 seconds ago. On 7/11/07, Hugh Perkins [EMAIL PROTECTED] wrote: Oh, lol because I'm stupid

Re: Re[4]: [Haskell-cafe] In-place modification

2007-07-14 Thread Hugh Perkins
So no, using the form of my argument, it is NOT possible to prove anything about Haskell -vs- C. It is ONLY possible to make claims about Haskell *libraries* -vs- C *libraries*. You can claim anything you like, but if you want people to believe it you'd be best providing the code used so that

Re: [Haskell-cafe] Looking for final year project - using Haskell, or another functional language

2007-07-14 Thread Hugh Perkins
Hi Claus, Well, I read the website and it stated that it doesnt support alpha blending yet. Thats a pretty basic operation, so I assumed no-one is using hopengl for anything more than a few triangles. I'll check the docs you've linked to. On 7/13/07, Claus Reinke [EMAIL PROTECTED] wrote:

Re: [Haskell-cafe] Looking for final year project - using Haskell, or another functional language

2007-07-14 Thread Hugh Perkins
Wow, ok, this does look amazingly comprehensive, cool :-) Might want to update the blurb on the website a little ;-) On 7/13/07, Claus Reinke [EMAIL PROTECTED] wrote: just be sure to ignore http://www.haskell.org/HOpenGL/ , which should be moved to the wiki or to /dev/null. instead, look at

Re: [Haskell-cafe] Re: Maintaining the community

2007-07-14 Thread Hugh Perkins
On 7/13/07, Philippa Cowderoy [EMAIL PROTECTED] wrote: This is a cultural thing, and assuming that it's a lack of sophistication on our part is a bad idea - on the contrary, some of the better reasons to avoid a web-based board are entirely about enabling sophistication. There's a very simple

Re: [Haskell-cafe] Looking for final year project - using Haskell, or another functional language

2007-07-14 Thread Hugh Perkins
Can someone post either a simple Hopengl example or a link to one please? (Something that displays a triangle or two, preferably rotatign slowly, ideally rotating when you move the mouse). ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Haskell monads for newbies

2007-07-14 Thread Hugh Perkins
On 7/14/07, Andrew Coppin andrewcoppin wrote: That is my recollection also. (Don't ask me *which* monads, mind you...) In the case in point, the law breakage never the less matches intuition; personally, I ignore the monad laws on the basis that if you're doing something sane, the laws will

[Haskell-cafe] Displaying fractions of a second from a datediff?

2007-07-14 Thread Hugh Perkins
Hi, Pretty dumb question I know, but..how to I display fractions of a second from a datediff? ie: main = do starttime - gettime -- do something here that takes a few seconds endtime - gettime let timediff = diffClockTimes endtime starttime let timediffstring

Re: [Haskell-cafe] Haskell monads for newbies

2007-07-14 Thread Hugh Perkins
Well, can you provide an example of an implementation of bind that satisfies an intuitive definition of bind but does not satisfy the monad laws? On 7/14/07, Derek Elkins [EMAIL PROTECTED] wrote: -Documentation- damn well better have the monad laws. Something is not a monad if it does not

[Haskell-cafe] Re: Displaying fractions of a second from a datediff?

2007-07-14 Thread Hugh Perkins
Ok, so for anyone who cares, the answer is, the negative picoseconds should be added to the seconds to get the final answer: let secondsfloat = realToFrac( tdSec timediff ) + realToFrac(tdPicosec timediff) / 1 ___ Haskell-Cafe

Re: Re[4]: [Haskell-cafe] In-place modification

2007-07-14 Thread Hugh Perkins
On 7/14/07, Henk-Jan van Tuyl [EMAIL PROTECTED] wrote: There was some discussion about prime number generators earlier this year: http://www.haskell.org/pipermail/haskell-cafe/2007-February/022347.html http://www.haskell.org/pipermail/haskell-cafe/2007-February/022699.html Ok, so using

Re: Re[4]: [Haskell-cafe] In-place modification

2007-07-14 Thread Hugh Perkins
As I say, I'm not a Haskell expert, so feel free to provide a better implementation. On 7/15/07, Chaddaï Fouché [EMAIL PROTECTED] wrote: ... Did you really read the Haskell code ? You're comparing two completely unrelated algorithms, talk about a fair comparison !

Re: Re[4]: [Haskell-cafe] In-place modification

2007-07-14 Thread Hugh Perkins
There's really a tendency in this newsgroup to point people to huge documents, when a small copy and paste would make the answer so much more accessible ;-) Anyway... so reading through the paper, it looks like its using a priority queue? Which basically is changing the algorithm somewhat

Re: Re[4]: [Haskell-cafe] In-place modification

2007-07-14 Thread Hugh Perkins
Chaddai, Unfortunately, your program doesnt work ;-) The function needs to take a parameter, which is the upper limit on our sieve, and return a single value, which is the number of primes in that interval. Complex requirements I know ;-) ___

Re: Re[4]: [Haskell-cafe] In-place modification

2007-07-14 Thread Hugh Perkins
On 7/15/07, Derek Elkins [EMAIL PROTECTED] wrote: Read http://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf Ok, so switched to using the Data.Map version from this paper, which looks like a lazy, but real, version of the sieve of Arostothenes. This does run quite a lot faster, so we're going

Re: Re[4]: [Haskell-cafe] In-place modification

2007-07-14 Thread Hugh Perkins
(Random observation: Hmmm, strange, in the Data.Map version of primes above, we are missing 5 primes?) Hi Chaddai, Your algorithm does work significantly better than the others I've posted here :-) So much so, that we're going for a grid of 1000 to get the timings in an easy-to-measure

Re: Re[4]: [Haskell-cafe] In-place modification

2007-07-15 Thread Hugh Perkins
Sebastian, Why would I write a slow, complicated algorithm in C#? I'm not making these comparisons for some academic paper, I'm trying to get a feel for how the languages run in practice. And really in practice, I'm never going to write a prime algorithm using merge and so on, I'd just use the

Re: Re[4]: [Haskell-cafe] In-place modification

2007-07-15 Thread Hugh Perkins
Hey, guys, I just realized this test is not really fair! I've been using the Microsoft .Net compiler ,which is a proprietary closed-source compiler. To be fair to Haskell, we should probably compare it to other open source products, such as g++ and mono? Here are the timings ;-) Haskell

Re: Re[4]: [Haskell-cafe] In-place modification

2007-07-15 Thread Hugh Perkins
On 7/15/07, Sebastian Sylvan [EMAIL PROTECTED] wrote: [me thinks he doth protest too much] ;-) The rules of the competition are quite fair: both sides make an optimal algorithm using their preferred language. It's ok to hardcode the first 3 or 4 primes if you must, hardcoding the entire

Re: Re[4]: [Haskell-cafe] In-place modification

2007-07-15 Thread Hugh Perkins
On 7/15/07, Donald Bruce Stewart [EMAIL PROTECTED] wrote: [snip] unsafeWrite[snip] [snip]unsafeRead[snip] Hi Donald, the idea is to use this for operational code, so avoiding unsafe operations is preferable ;-) You'll note that the C# version is not using unsafe operations, although to be

Re: Re[4]: [Haskell-cafe] In-place modification

2007-07-15 Thread Hugh Perkins
On 7/15/07, Donald Bruce Stewart [EMAIL PROTECTED] wrote: What C# version are you using, by the way? (So I can check if it does any tricks). - csc is in the Microsoft.Net Framework 2.0 runtime, which you can download from microsoft.com (free download). - gmcs/mono are from Mono 1.2.2.1 ,

Re: Re[4]: [Haskell-cafe] In-place modification

2007-07-15 Thread Hugh Perkins
On 7/15/07, Sebastian Sylvan [EMAIL PROTECTED] wrote: unsafe' here just means direct array indexing. Same as the other languages. Haskell's 'unsafe' is a little more paranoid that other languages. Yes, I was kindof hoping it was something like that. Cool :-) Since the goal is to flip

Re: Re[4]: [Haskell-cafe] In-place modification

2007-07-15 Thread Hugh Perkins
On 7/15/07, Hugh Perkins [EMAIL PROTECTED] wrote: On 7/15/07, Sebastian Sylvan [EMAIL PROTECTED] wrote: unsafe' here just means direct array indexing. Same as the other languages. Haskell's 'unsafe' is a little more paranoid that other languages. Yes, I was kindof hoping

Re: Re[4]: [Haskell-cafe] In-place modification

2007-07-15 Thread Hugh Perkins
On 7/15/07, Sebastian Sylvan [EMAIL PROTECTED] wrote: Well, *I* didn't say it but yes. Unsafe disables bounds checking (which in this case is safe). I think you can just stick an unsafe{} in the C# version to disable them. Oh well that's not good. Yes, you can use unsafe in C# too, but you

Re: Re[4]: [Haskell-cafe] In-place modification

2007-07-15 Thread Hugh Perkins
Hey, I just realized I can shave off another 30% in C# ;-) So now the timings become: Safe Haskell = J:\dev\haskellghc -O2 -o primechaddai.exe PrimeChaddai.hs J:\dev\haskellprimechaddai number of primes: 664579 Elapsed time: 26.234 Unsafe Haskell === J:\dev\haskellghc

  1   2   >