Re: meaning of "range" - use "interval" instead?

2010-09-23 Thread Doug McNutt
At 15:08 -0700 9/23/10, Darren Duncan wrote, and I snipped a bunch:
>Larry's updating the Synopsis terminology to say "sequence" instead of 
>"series" for correctness led me to check out what seems to be a similar 
>problem, "range".

Add to the list of meanings, in the world of computing, Microsoft Excel's use 
of a range object to represent a collection of worksheet cells, usually 
rectangular as (A1;Q10), as either a left or right item in a command. Like it 
or not there will be users of perl-6 who also use Excel or one of its 
equivalents in the open source community.
-- 

-->  Halloween  == Oct 31 == Dec 25 == Christmas  <--


meaning of "range" - use "interval" instead?

2010-09-23 Thread Darren Duncan
Larry's updating the Synopsis terminology to say "sequence" instead of "series" 
for correctness led me to check out what seems to be a similar problem, "range".


I believe that the Synopsis should just use the term "interval" for what it 
currently calls "range" (and "Interval" for "Range"); currently it uses both 
terms and Perl 6 has related types named "Range" and "RangeIter".


The problem stems from "range" having multiple relevant meanings in practice:

1.  A "where" or "region" kind of meaning, where it is used in the same way as 
"interval", as being a collection of everything between 2 locations/points.


2.  A "how much" or "distance" kind of meaning, where it is the (scalar) 
distance between 2 locations/points.


The relationship between these is like a generalization of the relationship 
between a temporal interval (with 2 temporal instant endpoints) and a temporal 
duration.


There is also a third meaning of "range" meaning the set of possible output 
values of a function, corresponding to "domain" as the set of possible inputs.


I believe that the name Interval is much more specific to the meaning that Range 
is going for, without having the other meanings that can confuse, while Range is 
more likely to confuse.


In particular, what would someone expect a function named range() to do?

It is often the case that range() would be expected take a nonempty set of 
numbers and return a number that is the difference between the largest and 
smallest numbers in the set.  For example, "range(5,-3,0,6,2,-1)" would return 9 
(6-(-3)); similarly, "range(25..52)" would return 27.


A range() function would be in the same category of functions as mean(), 
median(), mode(); each takes a nonempty set of numbers and returns a single number.


Now if Range were renamed to Interval, I don't see this as being a problem for 
anyone.  Sure, Interval is a longer word, but how often would the name of that 
type be written out in code?  Usually one produces an interval using ".."/etc 
notation anyway.


As for places you want to abbreviate, I recommend "Ivl" ("Int" won't work, 
obviously); it looks visually different and emphasizes distinct sounds.  For 
example, with "IvlIter"; granted, this doesn't read as well as "RangeIter", but 
would either appear in code that often anyway and not be more of an internal 
thing that's used implicitly?


So then, just use "interval" etc for that meaning and just use "range" for other 
meanings such as high-low distance or the output of a function, or just use it less.


The main wrinkle I can see here is if you were deliberately using "range" 
*because* it has multiple meanings, to try and convey all of those meanings at 
once.  While that may work in some cases, it seems *too* clever in this case. 
And if you want to say that, eg, casting a Range object as an integer returns 
the difference between its endpoints (meaning #2), Interval works for that too.


-- Darren Duncan



Re: [perl6/specs] 177959: s/series/sequence/ to accord with math culture

2010-09-23 Thread Darren Duncan

nore...@github.com wrote:

Commit: 17795925bc48affda10275bd2768e1f2d9ef6345

http://github.com/perl6/specs/commit/17795925bc48affda10275bd2768e1f2d9ef6345
Author: TimToady 
Date:   2010-09-23 (Thu, 23 Sep 2010)

Log Message:
---
s/series/sequence/ to accord with math culture

To a mathematician, a series is the sum of a sequence.  We don't want
to confuse the poor mathematicians any more than they already are.


These kinds of changes are always welcome.  Anything that will be more correct 
to the mathematicians/logicians/etc without being appreciably worse to anyone 
else is a good thing, this being an example. -- Darren Duncan


[perl6/specs] 177959: s/series/sequence/ to accord with math culture

2010-09-23 Thread noreply
Branch: refs/heads/master
Home:   http://github.com/perl6/specs

Commit: 17795925bc48affda10275bd2768e1f2d9ef6345

http://github.com/perl6/specs/commit/17795925bc48affda10275bd2768e1f2d9ef6345
Author: TimToady 
Date:   2010-09-23 (Thu, 23 Sep 2010)

Changed paths:
  M S03-operators.pod
  M S05-regex.pod
  M S09-data.pod
  M S32-setting-library/Containers.pod

Log Message:
---
s/series/sequence/ to accord with math culture

To a mathematician, a series is the sum of a sequence.  We don't want
to confuse the poor mathematicians any more than they already are.