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
On Tue, 16 Oct 2007, Peter Verswyvelen wrote:
Concurrent Clean uses the ~ symbol for unary negation. That's also a way
of fixing it.
Personally I could also live with allowing no space between the minus
sign and the number... If you leave a space, - becomes the subtract
operator.
Me
Duh, you're right... silly me. I always put spaces between the operator,
but many people of course don't.
Isaac Dupree wrote:
Peter Verswyvelen wrote:
Personally I could also live with allowing no space between the minus
sign and the number... If you leave a space, - becomes the subtract
Yes, I guessed it would.
Actually logging all those discussions is a good idea: I will make a
wiki page containing all the discussions I have with my wife, and then -
at the start of a new discussion - I can redirect her to the wiki page.
Problem solved, no energy wasted ;-)
Okay,
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
Hi
(/ 10) means the function that divides its argument by 10
(- 10) however is just the number -10, even if I put a space between the -
and 10.
How can I create a function that subtracts 10 from its argument in a clean
way then?
subtract is the way to go. (`subtract` 10)
I think you
On Tue, 2007-10-16 at 17:02 +0100, Neil Mitchell wrote:
Hi
(/ 10) means the function that divides its argument by 10
(- 10) however is just the number -10, even if I put a space between the -
and 10.
How can I create a function that subtracts 10 from its argument in a clean
way
Hi
I think you should have to write negative numbers using the syntax
0-10, since currently having one single unary operator is ugly.
I think writing 0-10 is ugly.
Ugly - yes. But very clear as to its meaning. How often do people
actually write negative numeric literals? My guess is that
On 10/16/07, Neil Mitchell [EMAIL PROTECTED] wrote:
Ugly - yes. But very clear as to its meaning. How often do people
actually write negative numeric literals?
Any time I need one. And I can guarantee I don't make the compiler
perform an arithmetic computation to get one, either.
--
Wise
I think you should have to write negative numbers using the syntax
0-10, since currently having one single unary operator is ugly.
I think writing 0-10 is ugly.
Ugly - yes. But very clear as to its meaning. How often do people
actually write negative numeric literals? My guess is that -1 is
Concurrent Clean uses the ~ symbol for unary negation. That's also a way
of fixing it.
Personally I could also live with allowing no space between the minus
sign and the number... If you leave a space, - becomes the subtract
operator.
Coming from C++ I always make the mistake to forget
Peter Verswyvelen wrote:
Personally I could also live with allowing no space between the minus
sign and the number... If you leave a space, - becomes the subtract
operator.
I once thought that... there was the opposition that (x-1) subtraction
of a constant appears too often. And I found
On Tue, Oct 16, 2007 at 06:27:19PM -0300, Isaac Dupree wrote:
Peter Verswyvelen wrote:
Personally I could also live with allowing no space between the minus
sign and the number... If you leave a space, - becomes the subtract
operator.
I once thought that... there was the opposition that
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. :) )
-- Lennart
On 10/17/07, John Meacham [EMAIL PROTECTED] wrote:
On Tue, Oct 16, 2007 at 06:27:19PM -0300, Isaac
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
26 matches
Mail list logo