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.
Simon
| -Original Message-
| From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On
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 go
One to add to your list, string edit distance - as its hard, and useful.
Keean.
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
With reference to the discussion a couple of days ago
about list implementations, here is some code showing the
idea I was talking about... Its a list that you can write
either single elements or blocks (UArrays) to, but it always
reads like a list of elements, so blocks can be read in, but
you ca
Keean writes (in the Haskell cafe):
[..]
data AList a = One !a (AList a)
| Many !Int !(UArray Int a) (AList a) | Nil
[..]
head (Many i a _) = a!i
[..]
a ++: l = Many 0 a l
You probably want to test in the definition of (++:) that
the array a is not of length 0.
Cheers,
Ronny
Hows this:
...
tail (Many i a l)
| i < (e-s) = (Many (i+1) a l)
| otherwise = l
where (s,e) = bounds a
...
a ++: l
| e >= s = Many s a l
| otherwise = l
where (s,e) = bounds a
A futher though is that with constructors you can do:
f (a:as) =
>class List l where
> head :: IArray UArray a => l a -> Maybe a
> tail :: IArray UArray a => l a -> Maybe (l a)
changed my mind about this... you cannot do: tail $ tail $ tail x
so added a 'null' test instead.
___
Haskell-Cafe mailing list
[EMAIL PRO
Hi,
having found a bit of time to play with Haskell, I am trying to figure
out how to enforce strict evaluation.
I wrote the following program:
main =
let x = zipWith (+) [5..] [6..]
in putStrLn $ show $ x `seq` head x
I expected this program not to terminate - because of the seq-
On 2004-10-10 at 11:20BST Malcolm Wallace wrote:
> As an example, instead of the following list-only code,
>
> f :: List a -> ...
> f []= ...
> f (h:t) = ...
>
> you could write this more general version, which assumes only some
> class Sequence with operations null, head, tail, e
On 2004-10-12 at 18:07+0200 Christian Hofer wrote:
> Hi,
>
> having found a bit of time to play with Haskell, I am trying to figure
> out how to enforce strict evaluation.
> I wrote the following program:
>
> main =
> let x = zipWith (+) [5..] [6..]
> in putStrLn $ show $ x `seq` hea
> main =
> let x = zipWith (+) [5..] [6..]
> in putStrLn $ show $ x `seq` head x
>
> I expected this program not to terminate - because of the seq-Operator,
> but it happily returns 11 in ghc as well as in ghci. What do I make
> wrong?
"seq" forces its argument to "Weak Head Normal
Am 12.10.2004 um 18:20 schrieb Keith Wansbrough:
But if you are just learning Haskell, you almost certainly don't need
to do this. Just make use of the laziness, and learn to love it!
Thank you for your replies. You are right: I don't need it. It's just
that I am currently studying the book Algor
Ferenc Wagner writes:
> Pretty neat. Wouldn't it be a nice addition to the
> Tutorials section on the Haskell Bookshelf?
Thank you. I certainly wouldn't mind having a link from
haskell.org to it. Neither would I mind having a link to the
BlockIO library itself, but in the past I couldn't seem t
Dear All,
List and IO are both monads when appropriate operations are defined.
The IO monad, which is a one-way monad, does not have a function of
type IO a -> a, in general, except an unsafe function
"unsafePerformIO :: IO a -> a". A two-way monad, such as List, has such
a function "head ::
OK, recently I posed a question about rethinking some OO idioms, and
that spawned some useful discussion.
I now have a followup question.
One of the best features of OO programming is that of inheritance. It
can be used to slightly alter the behavior of objects without requiring
modification to
On Tue, 12 Oct 2004, John Goerzen wrote:
> One of the best features of OO programming is that of inheritance. It
> can be used to slightly alter the behavior of objects without requiring
> modification to existing code or breaking compatibility with existing
> APIs.
I hesitate to express a contr
On Mon, Oct 11, 2004 at 09:53:16PM -0400, Scott Turner wrote:
> Evenutally I realized that calculating with lazy lists is not as
> smooth as you might expect. For example, the square root of 2 has a
> simple representation as a lazy continued fraction, but if you
> multiply the square root of 2 by
17 matches
Mail list logo