Re: [Chicken-users] Re: Bignums in core

2009-10-03 Thread Jim Ursetto
On Sun, Oct 4, 2009 at 1:21 AM, Thomas Bushnell BSG  wrote:
> So what you're saying is, who cares about doing the right thing, let's
> just do anything at all now.
>
> Well, my preference is to do the right thing.  What are you going to do
> when the inexactness bites you?

I suspect if there is any biting going on here, it is Felix biting his
tongue... with a supreme effort of will.

More likely he stopped reading the list for a while.

Jim


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Bignums in core

2009-10-03 Thread Nicholas "Indy" Ray
On Sat, Oct 3, 2009 at 11:19 PM, Thomas Bushnell BSG  wrote:

>
> The point here is that it is patently obvious that in fact you *do* need
> larger exact integers than Chicken Scheme supports at present.  Having
> inexact integers be used is, in my opinion, as wrong as accepting
> eight-byte blobs and using those as 64 bit integers.
>

I'm also not against eight-byte blobs for 64 bit integers in principle, But
as it turns out, flonums are a much more convenient representation.

On Sat, Oct 3, 2009 at 11:21 PM, Thomas Bushnell BSG  wrote:

> So what you're saying is, who cares about doing the right thing, let's
> just do anything at all now.
>
> In this case, using flonums gives a temporary solution to the problem, and
should also be easy to remove later on when we get higher range integers.
This is not an abstract "right thing" vs "anything at all now" philosophical
argument as both the right thing and the alternative are real tangible
things.


> Well, my preference is to do the right thing.  What are you going to do
> when the inexactness bites you?


I'm sorry but the discussion hasn't discussed the ways the inexactness may
bite. It seems to be a very controlled edge-case that can be avoided by
simply not dealing with large files and inexact numbers. Regardless many
other details of chicken scheme (most are related to the spec more then the
implementation) tend to "bite" I find the problem and work around it. That's
what we do as programmers trying to get work done.

On Sat, Oct 3, 2009 at 11:14 PM, Thomas Bushnell BSG  wrote:

> Huh?  The point is that if the user wants (set-file-position
> (inexact->exact n)) they should say so, and not have the system
> magically coerce something which needs to be an exact integer.


Sorry, I don't understand this comment, if they were to do that,
set-file-position! should receive an exact number, and handle it just fine.

Nicholas "Indy" Ray
___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Bignums in core

2009-10-03 Thread John Cowan
Nicholas Indy Ray scripsit:

> Bignums are nice and all, but I hardly see it as a practical
> necessity. Plus if I had to choose between fix/flonums or bignums
> and slower number performance, I'd choose the prior, that is why I
> use chicken!

Bignums don't hurt performance much unless you use them.  Ratios can
hurt performance, but I'm not proposing them: / should still return a
flonum if the mathematical result is not an integer.

-- 
John Cowan   co...@ccil.org
"You need a change: try Canada"  "You need a change: try China"
--fortune cookies opened by a couple that I know


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Re: Bignums in core

2009-10-03 Thread Thomas Bushnell BSG
So what you're saying is, who cares about doing the right thing, let's
just do anything at all now.

Well, my preference is to do the right thing.  What are you going to do
when the inexactness bites you?

On Sat, 2009-10-03 at 23:11 -0700, Nicholas "Indy" Ray wrote:
> On Sat, Oct 3, 2009 at 11:10 PM, Thomas Bushnell BSG 
> wrote:
> There's no need to implement everything at once...
> 
> In this case, I'm saying that rather than accept the *wrong*
> argument
> (inexact integers), we have a need for larger exact integers
> than we can
> support at present, and the right thing to do is add larger
> exact
> integers, not allow a function which should accept only exact
> integers
>  to start taking inexact ones.
> 
> 
> This is a dynamic and pragmatic language. If we were going for a
> type-safe statically compiled language I'd tend to agree. But in a
> dynamic language, this simple fix will allow problems to be solved
> (dealing with large files) in a fast (both in performance, and in time
> to get in the compiler) with little lost, and only in idealism.
> 
> 
> Indy
> 



___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Bignums in core

2009-10-03 Thread Thomas Bushnell BSG
So "bignum" is really not a Scheme concept.  It's a particular
implementation strategy.  Let's talk about the Scheme data types here.
Chicken scheme allows exact integers of limited size, and the limit is
fairly small.

The point here is that it is patently obvious that in fact you *do* need
larger exact integers than Chicken Scheme supports at present.  Having
inexact integers be used is, in my opinion, as wrong as accepting
eight-byte blobs and using those as 64 bit integers.

Thomas


On Sat, 2009-10-03 at 23:07 -0700, Nicholas "Indy" Ray wrote:
> Bignums are nice and all, but I hardly see it as a practical
> necessity. Plus if I had to choose between fix/flonums or bignums and
> slower number performance, I'd choose the prior, that is why I use
> chicken!
> 
> 
> Indy 
> 
> 
> On Sat, Oct 3, 2009 at 10:39 PM, John Cowan  wrote:
> Kon Lovett scripsit:
> 
> > I am not defending the lack of bignums in Chicken. Just
> trying to
> > understand the need.
> 
> 
> I think at this point it's about what people expect from a
> Scheme.
> Of the pre-R6RS implementations I tested, all of PLT, Gauche,
> MIT Scheme,
> Gambit, Bigloo, Scheme48/scsh, Guile, Kawa, SISC, Chez, SCM,
> STklos,
> and even tiny Chibi provide bignums.  In effect, bignums have
> become
> part of what a Scheme is.  Most of these systems limit bignums
> in one
> way or another to a size far less than all of memory, but all
> of them
> AFAIK handle numbers up to at least 2^(2^15).
> 
> Scraping the bottom of the implementation barrel, SigScheme
> has 28-bit
> fixnums and signals an error if you overflow them; however,
> bignum
> literals are interpreted as flonums.  SXM and S7, which are
> extremely
> minimal, wrap at 31 bits and 64 bits respectively, which is
> not even
> R5RS-conformant; SXM actually crashes if it reads a bignum
> literal.
> 
> Chicken and only Chicken converts fixnum operations to flonums
> on
> overflow.  This behavior is certainly licensed by R5RS, but it
> doesn't
> fit very well into the Scheme ecology.  The numbers egg just
> isn't a
> substitute for bignums in the core (and particularly in the
> FFI).
> 
> --
> Normally I can handle panic attacks on my own;   John Cowan
> 
> but panic is, at the moment, a way of life.
>  http://www.ccil.org/~cowan
> 
> 
> ___
> Chicken-users mailing list
> Chicken-users@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/chicken-users
> 
> 
> ___
> Chicken-users mailing list
> Chicken-users@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/chicken-users



___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Re: Bignums in core

2009-10-03 Thread Nicholas "Indy" Ray
On Sat, Oct 3, 2009 at 11:10 PM, Thomas Bushnell BSG  wrote:

> There's no need to implement everything at once...
>
> In this case, I'm saying that rather than accept the *wrong* argument
> (inexact integers), we have a need for larger exact integers than we can
> support at present, and the right thing to do is add larger exact
> integers, not allow a function which should accept only exact integers
>  to start taking inexact ones.
>

This is a dynamic and pragmatic language. If we were going for a type-safe
statically compiled language I'd tend to agree. But in a dynamic language,
this simple fix will allow problems to be solved (dealing with large files)
in a fast (both in performance, and in time to get in the compiler) with
little lost, and only in idealism.

Indy
___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Bignums in core

2009-10-03 Thread Thomas Bushnell BSG
On Sat, 2009-10-03 at 00:57 -0700, Kon Lovett wrote:
> While not "comfortable" with 10.0 as a file position is understandable  
> does anyone really use '(exact? some-filpos)'?

Huh?  The point is that if the user wants (set-file-position
(inexact->exact n)) they should say so, and not have the system
magically coerce something which needs to be an exact integer.

More to the point, the need is to implement it right, and not implement
it wrong and be permanently stuck with it.

Thomas




___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Bignums in core

2009-10-03 Thread Nicholas "Indy" Ray
Bignums are nice and all, but I hardly see it as a practical necessity. Plus
if I had to choose between fix/flonums or bignums and slower number
performance, I'd choose the prior, that is why I use chicken!

Indy

On Sat, Oct 3, 2009 at 10:39 PM, John Cowan  wrote:

> Kon Lovett scripsit:
>
> > I am not defending the lack of bignums in Chicken. Just trying to
> > understand the need.
>
> I think at this point it's about what people expect from a Scheme.
> Of the pre-R6RS implementations I tested, all of PLT, Gauche, MIT Scheme,
> Gambit, Bigloo, Scheme48/scsh, Guile, Kawa, SISC, Chez, SCM, STklos,
> and even tiny Chibi provide bignums.  In effect, bignums have become
> part of what a Scheme is.  Most of these systems limit bignums in one
> way or another to a size far less than all of memory, but all of them
> AFAIK handle numbers up to at least 2^(2^15).
>
> Scraping the bottom of the implementation barrel, SigScheme has 28-bit
> fixnums and signals an error if you overflow them; however, bignum
> literals are interpreted as flonums.  SXM and S7, which are extremely
> minimal, wrap at 31 bits and 64 bits respectively, which is not even
> R5RS-conformant; SXM actually crashes if it reads a bignum literal.
>
> Chicken and only Chicken converts fixnum operations to flonums on
> overflow.  This behavior is certainly licensed by R5RS, but it doesn't
> fit very well into the Scheme ecology.  The numbers egg just isn't a
> substitute for bignums in the core (and particularly in the FFI).
>
> --
> Normally I can handle panic attacks on my own;   John Cowan <
> co...@ccil.org>
> but panic is, at the moment, a way of life.
> http://www.ccil.org/~cowan
>
>
> ___
> Chicken-users mailing list
> Chicken-users@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/chicken-users
>
___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Re: Bignums in core

2009-10-03 Thread Thomas Bushnell BSG
On Fri, 2009-10-02 at 19:20 -0700, Kon Lovett wrote:
> On Oct 2, 2009, at 10:17 AM, Thomas Bushnell BSG wrote:
> 
> > On Fri, 2009-10-02 at 00:30 -0400, John Cowan wrote:
> >> Kon Lovett scripsit:
> >>
> >>> Possible is adding a int64_t heap type. But involves hitting every
> >>> piece of code that any extension of the core number system would.
> >>
> >> Indeed.  If we're going to do that, I'd rather go with core bignums
> >> after all, perhaps from LibTomMath (which is dedicated to the public
> >> domain by its author), and dispose of the issue once and for all.
> >
> > Something like this is surely my preference too.
> 
> Not sure what is desired. I am guessing the full numeric tower is the  
> real concern. If only large-ish integers then the current use of  
> integer flonum limit of +-9007199254740992 should be good for awhile.

There's no need to implement everything at once...

In this case, I'm saying that rather than accept the *wrong* argument
(inexact integers), we have a need for larger exact integers than we can
support at present, and the right thing to do is add larger exact
integers, not allow a function which should accept only exact integers
to start taking inexact ones.

Thomas




___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Bignums in core

2009-10-03 Thread John Cowan
Kon Lovett scripsit:

> I am not defending the lack of bignums in Chicken. Just trying to  
> understand the need.

I think at this point it's about what people expect from a Scheme.
Of the pre-R6RS implementations I tested, all of PLT, Gauche, MIT Scheme,
Gambit, Bigloo, Scheme48/scsh, Guile, Kawa, SISC, Chez, SCM, STklos,
and even tiny Chibi provide bignums.  In effect, bignums have become
part of what a Scheme is.  Most of these systems limit bignums in one
way or another to a size far less than all of memory, but all of them
AFAIK handle numbers up to at least 2^(2^15).

Scraping the bottom of the implementation barrel, SigScheme has 28-bit
fixnums and signals an error if you overflow them; however, bignum
literals are interpreted as flonums.  SXM and S7, which are extremely
minimal, wrap at 31 bits and 64 bits respectively, which is not even
R5RS-conformant; SXM actually crashes if it reads a bignum literal.

Chicken and only Chicken converts fixnum operations to flonums on
overflow.  This behavior is certainly licensed by R5RS, but it doesn't
fit very well into the Scheme ecology.  The numbers egg just isn't a
substitute for bignums in the core (and particularly in the FFI).

-- 
Normally I can handle panic attacks on my own;   John Cowan 
but panic is, at the moment, a way of life.  http://www.ccil.org/~cowan


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] set-file-position! only works with fixnums

2009-10-03 Thread Nicholas "Indy" Ray
On Sat, Oct 3, 2009 at 5:21 AM, Andreas Rottmann  wrote:

> Uhm, GMP is LGPL, so Chicken can use whatever license it likes, even if
> it would start to use GMP.
>

While strictly that is true, It does put some limitations on chicken and
built binaries. For instance, the LGPL requires everything to be dynamic
linked, which makes distribution of a single file executable built by
chicken more difficult, or impossible license wise. Perhaps more
importantly, Using GMP will prevent using chicken in embedded/proprietary
environments where NDAs prevent people without licenses from writting for
the platform (LGPL 3 has an anti-tivoization clause afaik) or where the NDA
prevents releasing of any required modifications for the platform.

Nicholas "Indy" Ray
___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] set-file-position! only works with fixnums

2009-10-03 Thread Andreas Rottmann
John Cowan  writes:

> Thomas Bushnell BSG scripsit:
>
>> I think this is a mistake, but "fixing" it is harder than it seems.
>> 
>> Really, this is totally non-schemey.  
>> 
>> The criterion should be an exact integer, just as it is for arrays.
>> Instead of allowing inexact integers to be file positions, how about
>> extending the hierarchy to handle these cases directly?
>
> Well, in order for that to work you have to persuade Felix to incorporate
> bignums in the core, and they can't be GMP bignums either because of
> the licensing -- that would make Chicken as a whole GPL, and that's not
> gonna happen.  Making all that happen is what is harder than it seems.
>
Uhm, GMP is LGPL, so Chicken can use whatever license it likes, even if
it would start to use GMP.

Regards, Rotty
-- 
Andreas Rottmann -- 


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Bignums in core

2009-10-03 Thread Kon Lovett


On Oct 2, 2009, at 9:01 PM, John Cowan wrote:


Kon Lovett scripsit:


Not sure what is desired. I am guessing the full numeric tower is the
real concern.


No, I see no need to smuggle the full tower in by the back door.
What I'd like to see is the Chicken core (FFI and all) migrated from
pure fixnum+flonum to fixnum+flonum+bignum, providing unlimited exact
integers plus IEEE double floats.  If even tiny Chibi Scheme can do  
that,

so can Chicken.  In fact, Chibi's routines are BSD-licensed and would
be easy to adapt to Chicken.


integer flonum limit of +-9007199254740992 should be good for awhile.


Sure, in contexts where people feel comfortable using inexact numbers.
But having to use them for file positions is a kludge.


While not "comfortable" with 10.0 as a file position is understandable  
does anyone really use '(exact? some-filpos)'?


I am not defending the lack of bignums in Chicken. Just trying to  
understand the need.




--
John Cowan   co...@ccil.org  http://www.ccil.org/~cowan
Most languages are dramatically underdescribed, and at least one is
dramatically overdescribed.  Still other languages are simultaneously
overdescribed and underdescribed.  Welsh pertains to the third  
category.

   --Alan King


Best Wishes,
Kon





___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users