I wrote:
Yitzchak Gale wrote:
So why not make the laziness available
also for cases where 1 - 2 == 0 does _not_ do
the right thing?
data LazyInteger = IntZero | IntSum Bool Integer LazyInteger
or
data LazyInteger = LazyInteger Bool Nat
or whatever.
Luke Palmer wrote:
data LazyInteger
On 10/19/07, Yitzchak Gale [EMAIL PROTECTED] wrote:
So why not make the laziness available
also for cases where 1 - 2 == 0 does _not_ do
the right thing?
data LazyInteger = IntZero | IntSum Bool Integer LazyInteger
or
data LazyInteger = LazyInteger Bool Nat
I think
data LazyInteger
Hi John,
I wrote:
- Zero really means 0, not 0 or negative
You wrote:
Actually, zero does mean zero. There is no such thing as negative
numbers in the naturals so it doesn't make sense to say '0 or negative'.
Well, then, 0 or error, or 0 or nothing. It clearly
does not mean zero.
I wrote:
Nice, lots of fun!
Wouldn't it be more convenient to allow them
to be signed?
John Meacham wrote:
Well, a couple reasons. One is that Natural numbers are a pretty useful
type in and of themselves, often times when used with lazy evaluation.
The other is that it is unclear what
On Thu, Oct 18, 2007 at 01:58:14PM +0200, Yitzchak Gale wrote:
- Zero really means 0, not 0 or negative.
Actually, zero does mean zero. There is no such thing as negative
numbers in the naturals so it doesn't make sense to say '0 or negative'.
Subtraction is necessarily defined differently of
John Meacham wrote:
if anyone is interested, Although I bet this has been implemented a
hundred times over, I have attached my lazy naturals module below just
for larks.
Nice, lots of fun!
Wouldn't it be more convenient to allow them
to be signed? True, you can't have laziness in
certain
On 10/17/07, John Meacham [EMAIL PROTECTED] wrote:
if anyone is interested, Although I bet this has been implemented a
hundred times over, I have attached my lazy naturals module below just
for larks. It is quite efficient as such things go and very lazy. for
instance (genericLength xs 5)
The one in the numbers package is not quite as clever as John's; it's the
naïve version of lazy naturals.
On 10/17/07, Stuart Cook [EMAIL PROTECTED] wrote:
On 10/17/07, John Meacham [EMAIL PROTECTED] wrote:
if anyone is interested, Although I bet this has been implemented a
hundred times
On Wed, Oct 17, 2007 at 12:41:54PM +0200, Yitzchak Gale wrote:
John Meacham wrote:
if anyone is interested, Although I bet this has been implemented a
hundred times over, I have attached my lazy naturals module below just
for larks.
Nice, lots of fun!
Wouldn't it be more convenient to
On Wed, Oct 17, 2007 at 09:16:47PM +0100, Lennart Augustsson wrote:
The one in the numbers package is not quite as clever as John's; it's the
naïve version of lazy naturals.
it appears to also be left biased in general, mine are symmetric and
commutative whenever possible and things like its
This module doesn't appear to be very lazy to me. For example, in ghci,
*Util.LazyNum List genericLength (1:2:undefined) (1 :: Nat)
*** Exception: Prelude.undefined
How is this module intended to be used?
___
Haskell-Cafe mailing list
On Wed, Oct 17, 2007 at 05:43:08PM -0700, David Benbennick wrote:
This module doesn't appear to be very lazy to me. For example, in ghci,
*Util.LazyNum List genericLength (1:2:undefined) (1 :: Nat)
*** Exception: Prelude.undefined
How is this module intended to be used?
Oops, sorry, the
On 10/17/07, John Meacham [EMAIL PROTECTED] wrote:
Oops, sorry, the version I posted was an intermediate one that had a
different addition algorithm. here is a better one that fixes that issue:
Zero + y = y
Sum x n1 + y = Sum x (y + n1)
note that it alternates the order in the recursive
On Wed, Oct 17, 2007 at 03:13:23AM +0100, Lennart Augustsson wrote:
If naturals have a perfectly reasonable subtraction then they also have a
perfectly reasonable negate; the default is 0-x.
(Oh, subtraction wasn't THAT reasonable, you say. :) )
I suppose I was overextending the use of
14 matches
Mail list logo