Re: [Haskell-cafe] speeding up fibonacci with memoizing

2007-02-18 Thread William Lee Irwin III
On Sun, Feb 18, 2007 at 06:15:25PM -0500, [EMAIL PROTECTED] wrote: Now that's an industrial-strength Fibonacci. It's O(log n) not including the cost of adding and multiplying large Integers, and uses a bounded amount of memory between calls, making it suitable for a library. The slowest part

Re: [Haskell-cafe] fastest Fibonacci numbers in the West

2005-01-28 Thread William Lee Irwin III
Am Donnerstag, 27. Januar 2005 06:08 schrieb William Lee Irwin III: Inspired by a discussion on freenode #haskell, I tried to write the fastest Fibonacci number function possible, i.e. given a natural number input n to compute F_n. For the moment, mlton-generated binaries crash computing fib

Re: [Haskell-cafe] Re: mathematical notation and functional programming

2005-01-28 Thread William Lee Irwin III
On Fri, Jan 28, 2005 at 08:16:59PM +0100, Henning Thielemann wrote: But what do you mean with 1/O(n^2) ? O(f) is defined as the set of functions bounded to the upper by f. So 1/O(f) has no meaning at the first glance. I could interpret it as lifting (1/) to (\f x - 1 / f x) (i.e. lifting from

Re: [Haskell-cafe] Re: mathematical notation and functional programming

2005-02-04 Thread William Lee Irwin III
On Fri, Jan 28, 2005 at 08:16:59PM +0100, Henning Thielemann wrote: But what do you mean with 1/O(n^2) ? O(f) is defined as the set of functions bounded to the upper by f. So 1/O(f) has no meaning at the first glance. I could interpret it as lifting (1/) to (\f x - 1 / f x) (i.e. lifting from

Re: [Haskell-cafe] Parity of the number of inversions of a permutation

2005-03-11 Thread William Lee Irwin III
On Wed, Mar 09, 2005 at 12:42:09PM +0100, Henning Thielemann wrote: I think it is a quite popular problem. I have a permutation and I want to count how often a big number is left from a smaller one. More precisely I'm interested in whether this number is even or odd. That's for instance the

Re: A simple problem

2001-01-18 Thread William Lee Irwin III
At 2001-01-18 15:57, William Lee Irwin III wrote: class C a where fun :: a - Integer instance Integral a = C a where fun = toInteger . succ On Thu, Jan 18, 2001 at 04:04:01PM -0800, Ashley Yakeley wrote: Gives "syntax error in instance head (constructor exp

Re: Revamping the numeric classes

2001-02-08 Thread William Lee Irwin III
On Thu, Feb 08, 2001 at 08:30:31PM +, Marcin 'Qrczak' Kowalczyk wrote: Signum doesn't require Ord. signum z = z / abs z for complex numbers. I'd be careful here. \begin{code} signum 0 = 0 signum z = z / abs z \end{code} This is, perhaps, neither precise nor general

Re: In hoc signo vinces (Was: Revamping the numeric classes)

2001-02-09 Thread William Lee Irwin III
Fri, 09 Feb 2001 10:52:39 +, Jerzy Karczmarczuk pisze: Again, a violation of the orthogonality principle. Needing division just to define signum. And of course a completely different approach do define the signum of integers. Or of polynomials... On Fri, Feb 09, 2001 at 07:19:21PM +,

Re: Semantics of signum

2001-02-10 Thread William Lee Irwin III
On Sat, Feb 10, 2001 at 11:25:46AM -0500, Dylan Thurston wrote: Can you elaborate? What do you mean by signum for functions? The pointwise signum? Then abs would be the pointwise abs as well, right? That might work, but I'm nervous because I don't know the semantics for signum/abs in such

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

2001-02-11 Thread William Lee Irwin III
Sun, 11 Feb 2001 13:37:28 +1300, Brian Boutel [EMAIL PROTECTED] pisze: Can you demonstrate a revised hierarchy without Eq? What would happen to Ord and the numeric classes with default class method definitions that use (==) either explicitly or in pattern matching against numeric literals? I

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

2001-02-11 Thread William Lee Irwin III
On 11-Feb-2001, Brian Boutel [EMAIL PROTECTED] wrote: There may be some misunderstanding here. If you are talking about type for which equality is always undefined, then I agree with you, but that is not what I was talking about. I was thinking about types where equality is defined for some

Re: A sample revised prelude for numeric classes

2001-02-11 Thread William Lee Irwin III
On Sun, Feb 11, 2001 at 05:42:15PM -0500, Dylan Thurston wrote: I've started writing up a more concrete proposal for what I'd like the Prelude to look like in terms of numeric classes. Please find it attached below. It's still a draft and rather incomplete, but please let me know any

Re: A sample revised prelude for numeric classes

2001-02-11 Thread William Lee Irwin III
At 2001-02-11 14:42, Dylan Thurston wrote: I've started writing up a more concrete proposal for what I'd like the Prelude to look like in terms of numeric classes. Please find it attached below. It's still a draft and rather incomplete, but please let me know any comments, questions, or

Re: A sample revised prelude for numeric classes

2001-02-11 Thread William Lee Irwin III
/(1-x), so x^(2n) - (-1)^n and x^(2n+1) - (-1)^n x, but you end up with an infinite number of (nonzero!) residues to add up and hence encounter the troubles with processes not being finite that I mentioned. On Sun, Feb 11, 2001 at 06:48:42PM -0800, William Lee Irwin III wrote: (3) Under some

Re: A sample revised prelude for numeric classes

2001-02-11 Thread William Lee Irwin III
On Mon, Feb 12, 2001 at 05:24:37PM +1300, Brian Boutel wrote: Including laws was discussed very early in the development of the language, but was rejected. IIRC Miranda had them. The argument against laws was that their presence might mislead users into the assumption that they did hold, yet

Re: A sample revised prelude for numeric classes

2001-02-11 Thread William Lee Irwin III
At 2001-02-11 21:18, Tom Pledger wrote: The main complication is that the type system needs to deal with integer exponents of dimensions, if it's to do the job well. On Sun, Feb 11, 2001 at 10:16:02PM -0800, Ashley Yakeley wrote: Very occasionally non-integer or 'fractal' exponents of

Re: In hoc signo vinces (Was: Revamping the numeric classes)

2001-02-12 Thread William Lee Irwin III
In a later posting Marcin Kowalczyk says: If (+) can be implicitly lifted to functions, then why not signum? Note that I would lift neither signum nor (+). I don't feel the need. ... On Mon, Feb 12, 2001 at 09:33:03AM +, Jerzy Karczmarczuk wrote: I not only feel the need, but I feel

Re: Primitive types and Prelude shenanigans

2001-02-15 Thread William Lee Irwin III
On Wed, Feb 14, 2001 at 02:19:39PM -0800, Simon Peyton-Jones wrote: The most immediate and painful stumbling block in Haskell 98 is that numeric literals, like 3, turn into (Prelude.fromInt 3), where "Prelude.fromInt" really means "the fromInt from the standard Prelude" regardless of whether

Re: Primitive types and Prelude shenanigans

2001-02-16 Thread William Lee Irwin III
William Lee Irwin III [EMAIL PROTECTED] pisze: literal "0" gets mapped to zero :: AdditiveMonoid t = t literal "1" gets mapped to one :: MultiplicativeMonoid t = t literal "5" gets mapped to (fromPositiveInteger 5) literal "-9&quo

Re: Primitive types and Prelude shenanigans

2001-02-16 Thread William Lee Irwin III
William Lee Irwin III [EMAIL PROTECTED] pisze: literal "5" gets mapped to (fromPositiveInteger 5) literal "-9" gets mapped to (fromNonZeroInteger -9) On Fri, Feb 16, 2001 at 05:42:17PM +, Marcin 'Qrczak' Kowalczyk wrote: Note that when a discussed generic

Re: Pointers in Haskell??

2001-12-10 Thread William Lee Irwin III
On Mon, Dec 10, 2001 at 12:58:33AM -0800, Simon Peyton-Jones wrote: | Simon Peyton-Jones. The implementation of functional | programming languages. Prentice-Hall, 1987 | | is this book could be made available online ? cos on amazon | it seems out of print. I'm planning to scan

Re: Precision of `Double's in Hugs

2002-01-12 Thread William Lee Irwin III
On Sun, Jan 13, 2002 at 01:43:32AM +, Liyang Hu wrote: 'fraid I've been too spoilt by Debian, haven't built anything from source in ages ... I'll notify Hugs' package maintainer and see if I can convince him/her to apply this ... No trouble at all; I feel this should be the default as

Re: can a lazy language give fast code?

2002-07-31 Thread William Lee Irwin III
On Wed, 31 Jul 2002, Andrew J Bromage wrote: Perhaps the ICFP contests are actually fairer as benchmarks than as competitions? On Wed, Jul 31, 2002 at 09:59:31AM +0100, D. Tweed wrote: Interesting thought, particularly if the judges announced changes to what the problem to be solved was

monadic stack to register machine translator

2002-11-13 Thread William Lee Irwin III
module GT where import Monad import Monoid import MonadState import MonadWriter import MonadRWS -- Just a quick exercise in using monads. -- Thought it'd be nice to share with the class. data GOp = PushVal Integer | Push Integer | Pop Integer | Slide Integer

Re: 1 line simple cat in Haskell

2002-11-13 Thread William Lee Irwin III
On Wed, 13 Nov 2002, William Lee Irwin III wrote: main = mapM_ (\h - mapM_ putChar = hGetContents h) = mapM (flip openFile $ ReadMode) = getArgs On Wed, Nov 13, 2002 at 07:46:41AM -0800, Hal Daume III wrote: main = interact id There is a semantic difference here, as the version I posted

Re: Lazy streams and unsafeInterleaveIO

2002-12-24 Thread William Lee Irwin III
On Mon, Dec 23, 2002 at 09:05:00AM +, Glynn Clements wrote: The main problems with lazy I/O are the lack of control over ordering (e.g. you can't delete the file until a stream has been closed, but you may not be able to control how long the stream remains open), and the inability to

Re: [Haskell-cafe] strictness and the simple continued fraction

2004-10-11 Thread William Lee Irwin III
On Mon, Oct 11, 2004 at 09:53:16PM -0400, Scott Turner wrote: I tried using continued fractions in a spiffy lazy list implementation a while ago. Never got them working as well as expected. Evenutally I realized that calculating with lazy lists is not as smooth as you might expect. For

Re: [Haskell-cafe] strictness and the simple continued fraction

2004-10-12 Thread William Lee Irwin III
On Tue, Oct 12, 2004 at 08:48:27AM +0100, Simon Peyton-Jones wrote: If you are interested in arbitrary precision arithmetic using continued fractions, you may want to check out the work of David Lester. And Peter Potts et al. Just type exact real arithmetic into Google. That's where I got

Re: [Haskell-cafe] Space leaks

2004-10-05 Thread William Lee Irwin III
On Wed, Oct 06, 2004 at 12:27:35PM +1000, Ben Lippmeier wrote: Now imagine that state is some large structure. The [x] list is a couple of hundred elements long, and you print out some - but not all - of the [y] elements. While the [y] list remains live, a whole collection of half

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

2004-10-08 Thread William Lee Irwin III
On Fri, Oct 08, 2004 at 08:35:40AM -0400, Robert Dockins wrote: 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

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

2004-10-08 Thread William Lee Irwin III
At some point in the past, someone wrote: 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. That

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

2004-10-08 Thread William Lee Irwin III
William Lee Irwin III [EMAIL PROTECTED] writes: Ugh, lousy cache properties... try rank-ordered B+ trees. There are probably better choices than that even. It's probably best Simon point us to references to what's actually useful here. On Fri, Oct 08, 2004 at 03:55:05PM +0200, Ketil Malde

Re: [Haskell-cafe] Re: OCaml list sees abysmalLanguage Shootoutresults

2004-10-08 Thread William Lee Irwin III
At some point in the past, someone's attribution was stripped from: It can't be transparent. A different type for semi-packed strings, On Fri, Oct 08, 2004 at 07:28:53PM +0100, MR K P SCHUPKE wrote: Again I disagree... I dont see why you cannot change the implementation of lists without

[Haskell-cafe] strictness and the simple continued fraction

2004-10-09 Thread William Lee Irwin III
So, I discovered that simple continued fractions are supposed to be spiffy lazy lists and thought I'd bang out some continued fraction code. But then I discovered ContFrac.hs and couldn't really better it. Of course, I went about trying to actually do things relying on their laziness, and

Re: [Haskell-cafe] strictness and the simple continued fraction

2004-10-09 Thread William Lee Irwin III
On Sat, Oct 09, 2004 at 12:33:53PM -0700, William Lee Irwin III wrote: So, I discovered that simple continued fractions are supposed to be spiffy lazy lists and thought I'd bang out some continued fraction code. But then I discovered ContFrac.hs and couldn't really better it. Of course, I went

Re: [Haskell-cafe] strictness and the simple continued fraction

2004-10-09 Thread William Lee Irwin III
On Sat, Oct 09, 2004 at 12:33:53PM -0700, William Lee Irwin III wrote: So, I discovered that simple continued fractions are supposed to be spiffy lazy lists and thought I'd bang out some continued fraction code. But then I discovered ContFrac.hs and couldn't really better it. Of course, I went

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

2004-10-26 Thread William Lee Irwin III
Ben Rudiak-Gould [EMAIL PROTECTED] writes: For this to really work properly the whole OS needs to be designed around it. Such OSes exist -- they're called capability-based -- but like so many other good ideas this one hasn't generated much interest in industry. I think we're stuck with

Re: Did you come to Haskell from Python? was Re: [Haskell-cafe] Are handles garbage-collected?

2004-10-26 Thread William Lee Irwin III
Remi Turk [EMAIL PROTECTED] writes: At least one. (Me) And, judging from the amount of references to Python in these mailing-lists, I really doubt I'm the only one. On Tue, Oct 26, 2004 at 09:21:10PM +0200, Shae Matijs Erisson wrote: At least two. I also came to Haskell from Python. I made a

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

2004-10-26 Thread William Lee Irwin III
On Tue, Oct 26, 2004 at 10:22:23PM +0200, Tomasz Zielonka wrote: My road to Haskell went from C, C++ and Perl through Ocaml, Clean and Erlang. I was mainly motivated by dissatisfaction with languages I used at the moment. I am very happy with Haskell and I think I'll be using it for some time.

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

2004-11-30 Thread William Lee Irwin III
On Tue, Nov 30, 2004 at 04:57:27PM +0100, Shae Matijs Erisson wrote: The #haskell irc channel on irc.freenode.net is composed of many different flavors of programmer, from self-educated 16 year olds on up to post doctoral students studying functional programming. I'm a self-educated,

Re: [Haskell-cafe] convergence of functions of Complex variables

2004-12-15 Thread William Lee Irwin III
On Wed, Dec 15, 2004 at 02:07:10AM -0800, William Lee Irwin III wrote: This does not work as expected on Complex numbers due to some odd typechecking hassles apparently associated with abs. How do I get this to typecheck for both real (e.g. Double) and Complex arguments? On Wed, Dec 15, 2004

[Haskell-cafe] convergence of functions of Complex variables

2004-12-15 Thread William Lee Irwin III
This does not work as expected on Complex numbers due to some odd typechecking hassles apparently associated with abs. How do I get this to typecheck for both real (e.g. Double) and Complex arguments? \begin{code} module Jacobi (sn, cn, dn, sd, cd, nd, cs, ds, ns, sc, dc, nc) where scd x k | abs

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

2005-01-19 Thread William Lee Irwin III
On 19 January 2005 09:45, Ben Rudiak-Gould wrote: Okay, my ignorance of Posix is showing again. Is it currently the case, then, that every GHC thread will stop running while a disk read is in progress in any thread? Is this true on all platforms? On Wed, Jan 19, 2005 at 01:39:05PM -, Simon