[chuck-users] Problem with mixed float int lists

Kassen signal.automatique at gmail.com
Wed Dec 9 17:03:34 EST 2009

2009/12/9 Hans Aberg <haberg at math.su.se>

> The rule that 'chuck' seems to use on explicit lists is to look at the
> first entry. If that number is without a decimal point, the list is of type
> int[], if has one, it is float[].

Yes, and I agree this is at times inconvenient.

> It would be easy to fix: look at all entries, and set it to int[] exactly
> when all numbers are without a decimal point.
I disagree. I want it to be set to float when I tell it to be a float. I may
want to use a list of numbers without decimals as a float. This may be
because the numbers will later change, or because of member function
overloading (for example with LiSa.rate() it matters a lot whether the
argument is a float or int), or because I want divisions to work in a
certain way.

As I see it array definitions are currently inconsistent with the implicit
cast from int to float that we have elsewhere.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20091209/99b93961/attachment.html>

More information about the chuck-users mailing list