Make numberFormat even better AND Cognitive Load
prothero at earthlearningsolutions.org
prothero at earthlearningsolutions.org
Wed Apr 26 10:00:51 EDT 2017
Folks,
This thread addresses two issues with numbers. The main issue being discussed is the display of numbers. This is very important and the main point of diddling with numberformat. I like the idea of making a behavior we can all use to format numbers in a variety of ways.
The other one is the internal representation of numbers in the engine. Currently, it seems there are either strings or numbers and the engine converts between the two, depending on rules that it carries internally. It's partially my bad that this issue got incorporated into this thread. But where I saw the problem was in the discussion of array keys and how the engine treated a[1] different from a[01]. It's really the way arrays work and that the keys are really text, not numbers (at least, that's what I understand from the discussion). I use arrays a lot and love them for this. They become a bit inconvenient when all I want is a numerically indexed array without gaps. But it's only a minor issue for me. When it comes to integers, I only need to decide whether to round or trunc a value.
When speed issues arise, the most transparent way of dealing with this would be to declare an integer type variable, and the engine would then treat all instances of that variable as an integer. We already declare variables as local or global, and I see no conflict with the xTalk language philosophy in adding that property to a variable.
Ok, I'll shut up about this for now. Sorry to unfocus the thread.
Best,
Bill P
William Prothero
http://es.earthednet.org
> On Apr 26, 2017, at 2:31 AM, Curry Kenworthy via use-livecode <use-livecode at lists.runrev.com> wrote:
>
>
> Roland:
>
>> I vote for the LC-NATIVE "Excel style" number format
>> (enhanced numberFormat in LC, not a new one, no
>> depreciation, but just different ways to achieve the same)
>
> Excel number format is powerful and popular, that's for sure.
>
> Richard:
>
>> The Excel spec is a guide, but not an implementation.
>> Making that work robustly, flexibly, and sensibly within
>> LiveCode is a considerable design project.
>
> SpreadLib supports a portion of the Excel number and date formatting, a good start on that effort and with some lessons learned. Excel does have its quirks like everything else.
>
> Over time I've also chosen my own favorite "Curry Lite" formatting features, with the convenience of a single code for both positive and negative. I tried some tests with that style, and here are the results:
>
> http://curryk.com/ck-num-format.png
>
> <http://curryk.com/ck-num-format.png>
>
> I can choose where to put a negative sign or parentheses, and include arbitrary text. Maybe I can break that out into a separate formatting library. Still want to try some of the crazier things that Excel can do. :)
>
> Best wishes,
>
> Curry Kenworthy
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list