Re: [Haskell-cafe] Proof of a multi-threaded application

2008-11-17 Thread Ketil Malde
Tim Docker [EMAIL PROTECTED] writes: My apologies for side-tracking, but does anybody have performance numbers for STM? I have an application waiting to be written using STM, boldly parallelizing where no man has parallelized before, but if it doesn't make it faster, Faster than what?

Re: [Haskell-cafe] implementing python-style dictionary in Haskell

2008-11-19 Thread Ketil Malde
Tillmann Rendel [EMAIL PROTECTED] writes: Why should a Haskell hash table need more memory then a Python hash table? I've heard that Data.HashTable is bad, so maybe writing a good one could be an option. One problem is that Haskell collections are lazy by default. I'm aware of a few use

Re: [Haskell-cafe] Windows vs. Linux x64

2008-11-25 Thread Ketil Malde
Bartosz Wójcik [EMAIL PROTECTED] writes: while working on my resent project I've noticed that my code seems to be faster under Windows than under Linux x64. Is Windows running in 32 bit? What gcc versions are you using on each system? Windows is 32 bit with GHC-6.8.3. Linux is 64 bit with

Re: [Haskell-cafe] workarounds for Codec.Compression.Zlib errors in darcs

2008-11-27 Thread Ketil Malde
Jason Dagit [EMAIL PROTECTED] writes: That is, if you use the optional specification of a header file for each foreign import, and if your Haskell compiler can compile via C, then any checking that types match between Haskell and C can be performed automatically, by the

Re: [Haskell-cafe] Windows vs. Linux x64

2008-11-27 Thread Ketil Malde
Bartosz Wójcik [EMAIL PROTECTED] writes: Win32 Core2Duo 1.8GHz 1GB RAM 17 Mb total memory in use MUT time 56.97s ( 57.02s elapsed) %GC time 0.5% Win32 Core2Duo 2.2GHz 2GB RAM 17 Mb total memory in use MUT time 57.44s ( 57.53s elapsed) %GC time 0.7%

Re: [Haskell-cafe] Data.ByteString vs Data.ByteString.Lazy vs Data.ByteString.Char8

2008-12-02 Thread Ketil Malde
Galchin, Vasili [EMAIL PROTECTED] writes: I think I am getting a namespace collition between Data.ByteString.Lazy.Char8.ByteString and Data.ByteString.Lazy.Internal.ByteString You rarely need to import 'Internal' directly. here is the error message Couldn't

Re: [Haskell-cafe] Data.ByteString vs Data.ByteString.Lazy vs Data.ByteString.Char8

2008-12-03 Thread Ketil Malde
Galchin, Vasili [EMAIL PROTECTED] writes: Warning: This package indirectly depends on multiple versions of the same package. This is highly likely to cause a compile failure. package binary-0.4.2 requires bytestring-0.9.0.1 package bio-0.3.4.1 requires bytestring-0.9.1.0 ah ha .. Ketil,

Re: [Haskell-cafe] Haskell project proposals reddit

2008-12-11 Thread Ketil Malde
Jason Dusek [EMAIL PROTECTED] writes: I think you are overlooking the Web 2.0 aspect of this. I've been wondering what reddit brings to the table that makes it worth keeping track of yet another web site, registering yet another user account, learning yet another interface. Assuming you're

Re: [Haskell-cafe] Time for a new logo?

2008-12-14 Thread Ketil Malde
Don Stewart d...@galois.com writes: I noticed a new haskell logo idea on a tshirt today, http://image.spreadshirt.net/image-server/image/configuration/13215127/producttypecolor/2/type/png Simple, clean and *pure*. Nice. For some more hubris, replace 'A' with 'The'. -k -- If I

Re: [Haskell-cafe] Time for a new logo?

2008-12-14 Thread Ketil Malde
J. Garrett Morris jgmor...@cecs.pdx.edu writes: Nice. For some more hubris, replace 'A' with 'The'. I had the very same thought :) It certainly wouldn't do to let, say, the existence of Concurrent Clean get in the way of our self-promotion. Well, they get to make T-shirts with Clean - the

Re: [Haskell-cafe] Time for a new logo?

2008-12-17 Thread Ketil Malde
Gianfranco Alongi gianfranco.alo...@gmail.com writes: I agree on what some people say; I see no point in trying to advertise elitism. For this reason, my favorite subtitle is pure . lazy . fun. Nice and friendly, with some doulbe meanings for the cognoscenti. (I'm sorry, but I can't bring

Re: [Haskell-cafe] Re: Time for a new logo?

2008-12-18 Thread Ketil Malde
George Pollard por...@porg.es writes: Might be interesting to try angling the ends of the stems to look something more like the guillemot in [1]. I might try this in Gimp but I'm no designer :P If you're on Linux or similar, I recommend Inkscape for this kind of thing. -k -- If I haven't

Re: [Haskell-cafe] Logos of Other Languages

2008-12-19 Thread Ketil Malde
Jules Bean ju...@jellybean.co.uk writes: So I agree with Ashley insofar as, there is no *need* for the logo to incorporate a lambda or a or suchlike devices. On the other hand, I think it's not necessarily a bad thing either, as long as it works with (1) and (2) above. I agree with this,

Re: [Haskell-cafe] Use of abbreviations in Haskell

2009-01-03 Thread Ketil Malde
Isaac Dupree m...@isaac.cedarswampstudios.org writes: Derek Elkins wrote: I haven't been able to find any semantic difficulties with this addition. I like it too... what I run into is that there's an implicit assumption that module of name Foo.Bar.Baz *must* be found in a file

Re: [Haskell-cafe] How to check object's identity?

2009-01-04 Thread Ketil Malde
Aaron Tomb at...@galois.com writes: As others have explained, the == operator doesn't tell you whether two values are actually stored at the same location in memory. Nobody yet mentioned that (==) doesn't guarantee *anything* - it's a user defined function. So while it may and should give

Re: Literate Programming

2000-09-27 Thread Ketil Malde
"D. Tweed" [EMAIL PROTECTED] writes: Unfortunately the last time I looked at CWEB it still had the same idea about identifiers as WEB itself, namely that if they match textually they are the same, which makes the automatic indexes produced less useful for C++: I've got twelve classes all

Re: Show, Eq not necessary for Num [Was: Revamping the numeric classes]

2001-02-09 Thread Ketil Malde
Brian Boutel [EMAIL PROTECTED] writes: The fact that equality can be trivially defined as bottom does not imply that it should be a superclass of Num, it only explains that there is an ugly way of working around the problem. There is nothing trivial or ugly about a definition that reflects

Re: A sample revised prelude for numeric classes

2001-02-12 Thread Ketil Malde
[EMAIL PROTECTED] (Marcin 'Qrczak' Kowalczyk) writes: Why do you stop at allowing addition on Dollars and not include multiplication by a scalar? Perhaps because there is no good universal type for (*). Sorry, it would have to have a different symbol. Is this ubiquitous enough that we

Re: Functional programming in Python

2001-05-20 Thread Ketil Malde
Manuel M. T. Chakravarty [EMAIL PROTECTED] writes: You want to be able to write f 1 2 + g 3 4 instead of (f 1 2) + (g 3 4) I do? Personally, I find it a bit confusing, and I still often get it wrong on the first attempt. The good thing is that the rule is simple to remember. :-)

Re: Functional programming in Python

2001-05-29 Thread Ketil Malde
Jerzy Karczmarczuk [EMAIL PROTECTED] writes: BTW, before I knew Haskell I exprimented with a syntax in which 'x f' is the application of 'f' to 'x', and 'x f g' means '(x f) g'. Hmmm. An experimental syntax, you say... Oh, say, you reinvented FORTH? Wouldn't x f g in a Forth'ish

Re: update in-place

2001-10-02 Thread Ketil Malde
Cagdas Ozgenc [EMAIL PROTECTED] writes: Could you help me on this notation? Perhaps? data Foo = Foo { a :: Int, b :: String } This declares a Foo constructor with two named fields, and Int a and a String b. This is equivalent to declaring data Foo = Foo Int String but with a

Re: streching storage manager

2001-09-28 Thread Ketil Malde
Saswat Anand [EMAIL PROTECTED] writes: As regard to Marcin's suggestion of using a list of compact arrays, although elements can be accessed faster, there will be a lot if redundancy since windows are overlapping. So consecutive arrays will contain almost same data. Hmmm - a circular

Re: UniCode

2001-10-08 Thread Ketil Malde
Dylan Thurston [EMAIL PROTECTED] writes: Right. In Unicode, the concept of a character is not really so useful; After reading a bit about it, I'm certainly confused. Unicode/ISO-10646 contains a lot of things that aren'r really one character, e.g. ligatures. most functions that

Re: Unicode support

2001-10-09 Thread Ketil Malde
[Posted to haskell-cafe, since it's getting quite off topic] Kent Karlsson [EMAIL PROTECTED] writes: for a long time. 16 bit unicode should be gotten rid of, being the worst of both worlds, non backwards compatable with ascii, endianness issues and no constant length encoding utf8

Re: Unicode support

2001-10-09 Thread Ketil Malde
Kent Karlsson [EMAIL PROTECTED] writes: You have endianness issues, and you need to explicitly type text files or insert BOMs. You have to distinguish between the encoding form (what you use internally) and encoding scheme (externally). Good point, of course. Most of the arguments apply

Re: = vs -

2001-10-09 Thread Ketil Malde
Mark Carroll [EMAIL PROTECTED] writes: On Tue, 9 Oct 2001, Ashley Yakeley wrote: At 2001-10-09 11:55, Mark Carroll wrote: What is the rationale for when Haskell demands a = and when it demands a -? Okay, I can't give you anything formal, but here's my intuitive understanding of things

Re: Haskell-beginners problem with memory consuption

2003-10-02 Thread Ketil Malde
Petter Egesund [EMAIL PROTECTED] writes: I load my file in one chunk, and does a lot of substitutes on the string - this is quick eating all my memory and the computers start to get really slow. Keep in mind that Strings are lists of characters. I think (somebody correct me if I'm wrong) GHC

Re: SV: Haskell-beginners problem with memory consuption

2003-10-02 Thread Ketil Malde
Petter Egesund [EMAIL PROTECTED] writes: fun :: String - String look for pat1 in string - if found subst with sub1 look for pat2 in string - if found subst with sub2 look for pat3 in string - if found subst with sub3 recurse until no pattern is found I would structure

Re: Limiting resources on a per-function basis?

2004-01-05 Thread Ketil Malde
Jeff Newbern [EMAIL PROTECTED] writes: Thanks for your input. I am mainly interested in this functionality to enhance my unit tests. I want to be able to run test cases with limits on time, heap, stack, etc. and fail the test if it exceeds the limits. Well, if you can isolate the tests well

Re: pet project - 7 Millennium Prize problemss

2004-01-05 Thread Ketil Malde
Christopher Milton [EMAIL PROTECTED] writes: I think Haskell can be used to solve several, if not all, of the seven problems. What's this? Is there an URL with more information? -kzm -- If I haven't seen further, it is by standing in the footprints of giants

Re: Hi, I have a question!

2004-01-11 Thread Ketil Malde
Derek Elkins [EMAIL PROTECTED] writes: Either use a different name for your operator, or specify the + that you want by writing OperationTest.+ instead of +. You can also hide the Prelude (+), though it is a somewhat useful function. Wouldn't making Nat an instance of Num also work?

Re: [Haskell-cafe] elemt from list

2004-01-27 Thread Ketil Malde
Pajo Patak [EMAIL PROTECTED] writes: I want to return a list, from and list of lists (all integers), where is the erroe in the code? nthList :: [[a]] - Int - [a] nthList ([x]:xs) 1 = [x] nthList ([x]:xs) (n+1) = nthListh xs n Did you try it at all? Prelude let { nthList ([x]:xs) 1

Re: [Haskell-cafe] Outstanding context : (Num b, Random b)

2004-02-26 Thread Ketil Malde
horsh [EMAIL PROTECTED] writes: Could anyone please explain why these two things are not equivalent: One of them has a type signature? -kzm -- If I haven't seen further, it is by standing in the footprints of giants ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] ????Pattern match(es) are overlapped???

2004-03-22 Thread Ketil Malde
Arjan van IJzendoorn [EMAIL PROTECTED] writes: newtype Method = Method String getMethod = Method GET putMethod = Method PUT doMeth getMethod = ... doMeth putMethod = ... You will have to write: doMeth (Method GET) = ... doMeth (Method PUT) = ... Or (I assume, haven't

Re: [Haskell-cafe] Newbie: Is it possible to catch _|_ ?

2004-04-06 Thread Ketil Malde
Russ Lewis [EMAIL PROTECTED] writes: Another newbie question: Is it possible to catch _|_ - that is, to encounter it, handle it and continue? Since _|_ is the value of a non-terminating computation, this requires you to solve the halting problem. GHC does occasionally detect loops, but for

Re: [Haskell-cafe] Newbie: Is it possible to catch _|_ ?

2004-04-07 Thread Ketil Malde
Russ Lewis [EMAIL PROTECTED] writes: Oh. I was figuring that the runtime would detect _|_ whenever evaluation requires that it calculate a given expressoin, and that expression is currently being evaluated...that is, some subset of an expression evaluates to the expression itself. You mean

Re: [Haskell-cafe] WildCard question

2004-04-13 Thread Ketil Malde
Paul Cosby [EMAIL PROTECTED] writes: Every time I try to use [underscore] in an definition it says something like the symbol /017 is not recognised Could that be \017, i.e. octal 17 (defined in ASCII as SI, whatever that may be)? Any help suggestions? Wild guess: Are your files using the

[Haskell-cafe] Re: [Haskell] Re: sizeFM type

2004-04-27 Thread Ketil Malde
[Moved to -cafe at SPJ's request] Serge D. Mechveliani [EMAIL PROTECTED] writes: On Mon, Apr 26, 2004 at 10:09:18PM +0200, Ketil Malde wrote: Serge D. Mechveliani [EMAIL PROTECTED] writes: length :: [a] - Integer

Re: [Haskell-cafe] Re: sizeFM type

2004-04-28 Thread Ketil Malde
S. Alexander Jacobson [EMAIL PROTECTED] writes: assuming Moore's law lasts I suspect Moore's law is dead or dying. Intel just announced the latest Prescott P4 at 3.6 GHz, up from 3.2 last June. That's only a 12.5% increase. One year before that, it was about 2.5GHz, or almost 30%. I didn't

Re: [Haskell-cafe] some newbie FFI questions

2004-07-01 Thread Ketil Malde
John Kozak [EMAIL PROTECTED] writes: data Pixel a = Pixel !a !a !a deriving Show I use ImageMagick to load the image, then build an Array of Pixel Floats. Building the array takes 45 seconds on a 2.5Ghz P4 with code compiled -O2, which seems slow to me - are my expectations

Re: [Haskell-cafe] migrating from python

2004-07-14 Thread Ketil Malde
paolo veronelli [EMAIL PROTECTED] writes: All these are very natural with dictionaries, so I'd like to figure out the haskell view. I've no clue what you're doing (or for that matter, what RDFs are), but is there any reason Data.FiniteMap doesn't do the job? -kzm -- If I haven't seen

Re: [Haskell-cafe] optimising for vector units

2004-07-26 Thread Ketil Malde
MR K P SCHUPKE [EMAIL PROTECTED] writes: Well I have to say the dataflow style of lazy programming made me think Haskell would be ideal for multi-processor use (and now HyperThreading is common most PCs have more than one processor from the code's point of view)... I was disappointed to

Re: [Haskell-cafe] optimising for vector units

2004-07-26 Thread Ketil Malde
Jon Cast [EMAIL PROTECTED] writes: factor c constant overhead, ^^ What makes you think the overhead is constant? (Referring to the overhead introduced by boxing and such, not parallelizing. Sorry if that wasn't clear) -kzm -- If I haven't seen further, it is by

Re: [Haskell-cafe] optimising for vector units

2004-07-27 Thread Ketil Malde
Jan-Willem Maessen - Sun Labs East [EMAIL PROTECTED] writes: I missed this bit: I'm building compilers for supercomputers at Sun casualSo, any plans for compilers for functional languages making use of Niagara? -kzm -- If I haven't seen further, it is by standing in the footprints of giants

Re: [Haskell-cafe] exceptions vs. Either

2004-08-03 Thread Ketil Malde
Graham Klyne [EMAIL PROTECTED] writes: 2. I like to distinguish between expected errors and unexpected errors. Having been burned in the past by using exceptions (not FP), I try to use them only for conditions that are truly unexpected; i.e. _exceptional_. Bad input, IMO, is something that

Re: [Haskell-cafe] exceptions vs. Either

2004-08-03 Thread Ketil Malde
MR K P SCHUPKE [EMAIL PROTECTED] writes: head :: [a] - Maybe a head (a0:_) = Just a0 head _ = Nothing Argh, no! Violating the precondition of head is a bug in the caller, I want it to crash, but I also want to know where. Wrapping it up in Maybe (or any other error propagation) is not a

Re: [Haskell-cafe] exceptions vs. Either

2004-08-04 Thread Ketil Malde
MR K P SCHUPKE [EMAIL PROTECTED] writes: As for head, I think it's fine that it throws an error because it is specified to be defined for only non-empty lists. But surely it is better to encode this fact in the type system by useing a separate type for non-empty lists. Yes, in principle.

Re: [Haskell-cafe] exceptions vs. Either

2004-08-04 Thread Ketil Malde
MR K P SCHUPKE [EMAIL PROTECTED] writes: mins = map ((\(x:_)-x).sort) maybe what you meant was: case sort x of (x:_) - ... do whatever with x ... _ - ... do failure conition ... No, I don't think so. I only want the bug to be reported, and the umatched pattern

Re: [Haskell-cafe] exceptions vs. Either

2004-08-04 Thread Ketil Malde
David Roundy [EMAIL PROTECTED] writes: Here bug is a function that just calls error with a little prefix explaining that there is a bug in darcs, and would the user please report it. Obviously, defining a head here would be just as easy, Cool! The basic trick is just to inline the actual

Re: [Haskell-cafe] exceptions vs. Either

2004-08-04 Thread Ketil Malde
Ketil Malde [EMAIL PROTECTED] writes: Unless I'm overlooking something Which I of course did. #define at (let {at (y:_) 0 = y; at (y:ys) n = at ys (n-1); at _ _ = bug at __FILE__ __LINE__} in \a x - at a x) No prize for spotting the bug here. -kzm -- If I haven't seen further

Re: [Haskell-cafe] exceptions vs. Either

2004-08-04 Thread Ketil Malde
Ketil Malde [EMAIL PROTECTED] writes: import Prelude hiding (head,(!!),read) Any comments? Here's one: I thought this would make it difficult to have other imports of Prelude, hiding other pieces of it (e.g. catch, to avoid ambiguities with Control.Exception.catch) (Also, the definition

Re: [Haskell-cafe] closed classes

2004-08-06 Thread Ketil Malde
Malcolm Wallace [EMAIL PROTECTED] writes: Ah, but now you cannot use (Closed t) = as a predicate in type signatures, and since you cannot write a partial signature, you must omit the signature altogether... Hmm..yes, that would be a disadvantage. :-) -ketil -- If I haven't seen further, it

Re: [Haskell-cafe] cost of List.// for Ord types?

2004-09-08 Thread Ketil Malde
Fergus Henderson [EMAIL PROTECTED] writes: Basically, I'm wondering if I should avoid using the standard library \\, If efficiency is a significant concern, and the lists involved may be long, yes, you should. I'm not sure how to preserve the semantics, either. (\\) seems to delete the first

Re: [Haskell-cafe] Writing binary files?

2004-09-13 Thread Ketil Malde
Glynn Clements [EMAIL PROTECTED] writes: Right now, the attempt at providing I18N for free, by defining Char to mean Unicode, has essentially backfired, IMHO. Anything that isn't ISO-8859-1 just doesn't work for the most part, and anyone who wants Basically, I'm inclined to agree with what

Re: [Haskell-cafe] Re: OCaml list sees abysmal Language Shootoutresults

2004-10-13 Thread Ketil Malde
Shawn Garbett [EMAIL PROTECTED] writes: viewpoint: What if List were a type class? Or, what if String were one? Could we have painless read/show with arrays of Char, as well as lists, for instance? -kzm -- If I haven't seen further, it is by standing in the footprints of giants

Re: [Haskell-cafe] OCaml list sees abysmal Language Shootout results

2004-10-06 Thread Ketil Malde
Greg Buchholz [EMAIL PROTECTED] writes: I've been looking at the other shootout results (with the hope of learning something about making haskell programs faster/less memory hungry) and I couldn't quite figure out why the Hashes, part II test comsumes so much memory (

Re: [Haskell-cafe] OCaml list sees abysmal Language Shootout results

2004-10-06 Thread Ketil Malde
Ketil Malde [EMAIL PROTECTED] writes: To get memory consumption down, I tried a strict update function: update k fm = let x = (get hash1 k + get fm k) in x `seq` addToFM fm k x which slowed the program down(!), I wonder if this isn't due to never evaluating the values

Re: [Haskell-cafe] Can I determin the function name passed in?

2004-10-07 Thread Ketil Malde
Keith Wansbrough [EMAIL PROTECTED] writes: Instead, you should pass around data items that contain both the function and its name - either just pairs, [...] or proper data types ...or both, using records: data NamedFunc a b = NamedFunc { nameOf :: String, apply :: (a-b) } f =

Re: [Haskell-cafe] Re: OCaml list sees abysmal Language Shootout results

2004-10-07 Thread Ketil Malde
Peter Simons [EMAIL PROTECTED] writes: Keith Wansbrough writes: Count me as a vote for the better-but-slightly-slower wc. How about the attached program? On my machine it faster than Tomasz's version, and I think it's still a fairly clean source code I guess it's possible to submit three

Re: [Haskell-cafe] Re: OCaml list sees abysmal Language Shootout results

2004-10-07 Thread Ketil Malde
Peter Simons [EMAIL PROTECTED] writes: The problem is not Haskell, nor is it the implementation. The problem is that beginners, including yours truly, tend to write awfully inefficient code once you give them a String and tell them: Here, that's the contents of your file. And it's just so

Re: [Haskell-cafe] Re: OCaml list sees abysmal Language Shootoutresults

2004-10-08 Thread Ketil Malde
William Lee Irwin III [EMAIL PROTECTED] writes: Actually, I've been wondering about this. If my understanding is correct, Haskell lists are basicly singly-linked lists of cons cells (is that correct?) A simple (I think) thing to do would be to make the lists doubly-linked and circular.

Re: [Haskell-cafe] Subsequence near solved hopefully

2004-10-17 Thread Ketil Malde
Remi Turk [EMAIL PROTECTED] writes: You might also want to look at the earlier `any prefix of tails' suggestion, as it makes the solution a rather simple one-liner. Wouldn't that be looking for a sub*string*, and not a (general) sub*sequence* (which I think does not have to be contigous?)

Re: [Haskell-cafe] Subsequence near solved hopefully

2004-10-17 Thread Ketil Malde
Peter Stranney [EMAIL PROTECTED] writes: Thanks guys for all your help, finally through code, sweat and tears i have found the solution; Well done! I hope you don't mind some further comments? isSubStrand:: String - String - Bool isSubStrand [] [] = True isSubStrand [] (y:ys) = False You

Re: [Haskell-cafe] Are handles garbage-collected?

2004-10-25 Thread Ketil Malde
Remi Turk [EMAIL PROTECTED] writes: IMO, [bracket] does indeed have those same drawbacks. (Although the traditional explicit memory management model is alloc/free, which is much worse than bracket/withFile) Isn't bracket more like stack allocated memory? And most problems with explicit

Re: [Haskell-cafe] Are handles garbage-collected?

2004-10-26 Thread Ketil Malde
Marcin 'Qrczak' Kowalczyk [EMAIL PROTECTED] writes: - 8 times more popular on c.l.python than c.l.java, - 11 times more popular on c.l.python than c.l.perl, - 16 times more popular on c.l.python than c.l.c, but finally - 4 times *less* popular on c.l.python than c.l.scheme, i.e. the

Re: [Haskell-cafe] Set of reals...?

2004-10-28 Thread Ketil Malde
Stijn De Saeger [EMAIL PROTECTED] writes: But, like you mentioned in your post, now I find myself needing a notion of subset relations, and since you obviously can't define equality over functions, i'm stuck again. Perhaps one can define an approximate equality, with an error bound? Define

Re: [Haskell-cafe] Processing of large files

2004-11-01 Thread Ketil Malde
Alexander N. Kogan [EMAIL PROTECTED] writes: How should I modify it to make it useful on large file? It eats too much memory... procFile = putStrLn . show . foldl merge [] . ^ words foldl is infamous for building the complete list, before

Re: [Haskell-cafe] Newbie Question on type constructors

2004-11-02 Thread Ketil Malde
Ben Rudiak-Gould [EMAIL PROTECTED] writes: In particular, your notation with type signatures makes it totally unclear that Circle and Square have disjoint ranges; in fact it looks like they have the same range. : The syntax that would have made the most sense to me would have been

Re: [Haskell-cafe] Re: Processing of large files

2004-11-02 Thread Ketil Malde
Alexander Kogan [EMAIL PROTECTED] writes: Thanks! I did the following: For extra credit, you can use a FiniteMap to store the words and counts. They have, as you probably know, log n access times, and should give you a substantial performance boost. :-) (I have a feeling FMs are slow when the

Re: [Haskell-cafe] Re: Processing of large files

2004-11-04 Thread Ketil Malde
Tomasz Zielonka [EMAIL PROTECTED] writes: Thank you. It works for me too, but I don't understand why and how ;-)) Could you explain? I'm a bit puzzled by this discussion, as strictness of FiniteMaps have rarely been (perceived to be?) a problem for me. Scott's solution forces (lookupFM a' x)

Re: [Haskell-cafe] Sound library?

2004-12-03 Thread Ketil Malde
Henning Thielemann [EMAIL PROTECTED] writes: On Fri, 3 Dec 2004, Jason Bailey wrote: Would anyone know of packages out there for Haskell that support mp3's or ogg files? Do you mean realtime unpacking and playback? I'm afraid without hacking Haskell programs are too slow for that.

Re: [Haskell-cafe] Re: Non-technical Haskell question

2004-12-06 Thread Ketil Malde
John Goerzen [EMAIL PROTECTED] writes: sensibly share libraries between apps. Anyway, disc is cheap. Memory not so much, though. One advantage of having something in .so form is that every instance of every application that uses it shares the same in-memory image of the code. Well, a 5

Re: [Haskell-cafe] Re: Non-technical Haskell question

2004-12-06 Thread Ketil Malde
Philippa Cowderoy [EMAIL PROTECTED] writes: The strip utility helps somewhat You're right, of course. My executable (incidentally on Sparc) seems to have an overhead of approximately one megabyte when just considering the text segment (that is, subtracting the text sizes of my own .o files).

Re: [Haskell-cafe] Parse text difficulty

2004-12-09 Thread Ketil Malde
Douglas Bromley [EMAIL PROTECTED] writes: I've show(n) a particular data type and it shows up as: [([2,6],British),([1],Charles),([1,8],Clarke),([2,6],Council),([2],Edinburgh),([1],Education),([4],Increasingly)] Let me guess: type [([Integer],String)]? What I want to do is format that nicely

Re: [Haskell-cafe] Parse text difficulty

2004-12-09 Thread Ketil Malde
Robert Dockins [EMAIL PROTECTED] writes: And I thought that most programmers used zipWith, which has to be prefix. [1..5] `zipWith (+)` [7..] You don't have a computer at your end of the internet? :-) Prelude [1..5] `zipWith (+)` [7..] interactive:1: parse error on input `('

Re: [Haskell-cafe] Non-technical Haskell question

2004-12-10 Thread Ketil Malde
clearly this guy has never seen Phil Wadler. Some people may find this tasteless - I thought it was funny, so I guess those people will find me tasteless also. In that case, I'm probably already in their kill files, so this won't offend anybody.

Re: [Haskell-cafe] AbstractDataType question

2004-12-13 Thread Ketil Malde
Tomasz Zielonka [EMAIL PROTECTED] writes: Record field labels can be also used in pattern matching and in record update. Especially the latter is very useful. But not quite as elegant -- while record query lets you modify the underlying structure and replace the old record queries with

Re: [Haskell-cafe] Begginer question

2005-01-06 Thread Ketil Malde
Maurício [EMAIL PROTECTED] writes: complex_root :: (Float, Float, Float) - (Complex Float, Complex Float) complex_root (a,b,c) = (x1,x2) where { delta = b * b - 4 * a * c :: Float; sqr_delta = if delta = 0 then (sqrt delta) :+ 0 else 0 :+ (sqrt delta) :: (Complex

Re: [Haskell-cafe] Re: Utility functions

2005-01-06 Thread Ketil Malde
Simon Marlow [EMAIL PROTECTED] writes: There are already a couple of bits of (L)GPL under fptools: GMP and readline. GMP we'd like to replace because it is necessarily a part of every compiled Haskell program; readline isn't so important but it would be nice to have a BSD-licensed

Re: [Haskell-cafe] Some random newbie questions

2005-01-07 Thread Ketil Malde
[EMAIL PROTECTED] writes: I'm constantly surprised hearing from so many people about their space problems. I cannot remember having space problems with my programs. I don't know what everybody else is doing wrong :-) At least two common cases. Extracting compact data structures from large

Re: [Haskell-cafe] Hugs vs GHC (again) was: Re: Some random newbiequestions

2005-01-10 Thread Ketil Malde
Marcin 'Qrczak' Kowalczyk [EMAIL PROTECTED] writes: - Do the character class functions (isUpper, isAlpha etc.) work correctly on the full range of Unicode characters? It's not obvious what the predicates should really mean, e.g. should isDigit and isHexDigit include non-ASCII digits or

Re: [Haskell-cafe] Re: Hugs vs GHC (again) was: Re: Some randomnewbiequestions

2005-01-11 Thread Ketil Malde
Simon Marlow [EMAIL PROTECTED] writes: For unix, there are couple different tacks one could take. The locale system is standard, and does work, but is ugly and a pain to work with. In particular, it's another (set of) global variables. And what do you do with a character not expressible in

Re: [Haskell-cafe] Typing question

2005-01-11 Thread Ketil Malde
Dmitri Pissarenko [EMAIL PROTECTED] writes: a) How should I define the types of the attributes correctly? data Purchase = P Double Double data Customer = C Int [Purchase] or, if you want named fields: data Purchase = P { price, rebate :: Double } data Customer = C { id :: Int,

Re: [Haskell-cafe] Re: Hugs vs GHC (again) was: Re: Some randomnewbiequestions

2005-01-11 Thread Ketil Malde
Okay, I've taken a look (there seems to be some differences between the web page and the tgz from the wiki - fileGet seems to have disappeared). I still don't grok much of it, so just ignore me if I'm being overly naive. Anyway. Let's see, I can now open a stream from a file by doing: f

Re: [Haskell-cafe] Signature of a function

2005-01-11 Thread Ketil Malde
Dmitri Pissarenko [EMAIL PROTECTED] writes: When I remove the line activityIndicator :: Customer - Num What is wrong in the signature above? Try ':i activityIndicator'? -kzm -- If I haven't seen further, it is by standing in the footprints of giants

[Haskell-cafe] Re: Character predicates

2005-01-11 Thread Ketil Malde
Marcin 'Qrczak' Kowalczyk [EMAIL PROTECTED] writes: Dimitry Golubovsky [EMAIL PROTECTED] writes: [Proposal: ASCII.isDigit is true for '0'..'9', Unicode.isDigit is true for whatever Unicode defines as digits] So there might be a bunch of (perhaps autogenerated, from localedef files) modules

Re: [Haskell-cafe] Re: I/O interface

2005-01-13 Thread Ketil Malde
Keean Schupke [EMAIL PROTECTED] writes: At the end of the day IO is serial by nature (to one device anyway), so the way to do this into one file is to have one thread that reads and writes, and to 'send' read and write requests over channels from the threads that need the work done Would the

Re: [Haskell-cafe] Re: I/O interface

2005-01-13 Thread Ketil Malde
Marcin 'Qrczak' Kowalczyk [EMAIL PROTECTED] writes: Ketil Malde [EMAIL PROTECTED] writes: It seemed to me, though, that streams are related to channels, I'm not sure what exactly do you mean by streams (because they are only being designed), but differences are: Sorry for being unclear, I

Re: [Haskell-cafe] Question about instance

2005-01-14 Thread Ketil Malde
John Velman [EMAIL PROTECTED] writes: data Relation a i b = Rel {name::RN, arity::Int, members::(Set [EN])} Why do you parametrize the data type when you don't use the parameters? Either do data Relation = Rel {name::RN, arity::Int, members::Set [EN]} or data Relation a i b =

Re: [Haskell-cafe] Linear shuffle

2005-01-14 Thread Ketil Malde
Gracjan Polak [EMAIL PROTECTED] writes: shuffle :: [a] - IO [a] shuffle [] = return [] shuffle x = do r - randomRIO (0::Int,length x - 1) s - shuffle (take r x ++ drop (r+1) x) return ((x!!r) : s) This algorithm seems not effective, length, take, drop and (!!) are costly.

Re: [Haskell-cafe] Linear shuffle

2005-01-14 Thread Ketil Malde
Tomasz Zielonka [EMAIL PROTECTED] writes: On Fri, Jan 14, 2005 at 09:17:41AM +0100, Gracjan Polak wrote: This algorithm seems not effective, length, take, drop and (!!) are costly. Is there any better way to implement shuffle? You can use mutable arrays (modules Data.Array.MArray,

Re: [Haskell-cafe] Linear shuffle

2005-01-14 Thread Ketil Malde
Tomasz Zielonka [EMAIL PROTECTED] writes: But is that better, really? IIUC, you will now need to shift the first part of the string to the right, so it's still a linear operation for each shuffle. Perhaps I don't know this particular algorithm, but you can shuffle the array with linear

Re: [Haskell-cafe] Linear shuffle

2005-01-14 Thread Ketil Malde
Keean Schupke [EMAIL PROTECTED] writes: Please see: http://okmij.org/ftp/Haskell/perfect-shuffle.txt For an explanation of the algorithm. Right. I was commenting based on the source posted by Gracjan. (And http://c2.com/cgi/wiki?LinearShuffle contains a variety of shuffling algorithms).

Re: [Haskell-cafe] RE: Answers to Exercises in Craft of FP

2005-01-19 Thread Ketil Malde
David Owen [EMAIL PROTECTED] writes: Do you know if there are solutions to exersises available somewhere? Have you gone through the whole book, i.e. all the exercises? Unfortuantely I don't know of anywhere that the exercise answers can be found, even after some google searching. Another

Re: [Haskell-cafe] Math libraries for Haskell

2005-01-19 Thread Ketil Malde
Keean Schupke [EMAIL PROTECTED] writes: Can I request 2 types, one for dense (complete) matricies and another for sparse matricies? ...and maybe also put (!) in a class, so that it can be used as a general indexing operator for all indexed data structures? (Or is this already possible? I

Re: [Haskell-cafe] Reading images (PGM)

2005-01-20 Thread Ketil Malde
Greg Buchholz [EMAIL PROTECTED] writes: I need to write a function in Haskell, which 1) reads a greyscale image (for instance, in JPEG, PNG or the like) and If you can specify any image format you want, and you're not concerned with efficiency, you can't beat the simplicity of the

Re: [Haskell-cafe] Re: Hugsvs GHC (again)was: Re: Somerandomnewbiequestions

2005-01-21 Thread Ketil Malde
Duncan Coutts [EMAIL PROTECTED] writes: The point is that the Unix documentation does not consider the short pause as data is read off your hard drive to be blocking. So that's why select will always report that data is available when you use it with a file handle. Isn't this also for

Re: [Haskell-cafe] LGPL libraries

2007-03-06 Thread Ketil Malde
Kirsten Chevalier wrote: I am not a lawyer, but there are a couple of important points getting missed in this thread: [...] That's just silly isn't a defense. [...] and thus trust me, we're not going to sue you isn't the answer they're looking for, even if it's a completely accurate

Re: [Haskell-cafe] idea for avoiding temporaries

2007-03-08 Thread Ketil Malde
David Roundy wrote: Actually, I was thinking this sounded a lot like DiffArrays. Except that DiffArrays are slow and expensive in both space and time (compared with strict unboxed arrays). They necesarily hold boxed values so you pay a factor of at least two in space cost (for arrays of

Re: [Haskell-cafe] Lazy IO and closing of file handles

2007-03-15 Thread Ketil Malde
Donald Bruce Stewart wrote: pete-expires-20070513: When using readFile to process a large number of files, I am exceeding the resource limits for the maximum number of open file descriptors This is very annoying - I can't see any good reason why file descriptors should run out (before

<    2   3   4   5   6   7   8   9   10   >