[e-lang] Documentation bug for FlexList
Kevin Reid
kpreid at mac.com
Fri Mar 16 15:34:37 CDT 2007
On Mar 16, 2007, at 15:24, David Hopwood wrote:
> David Hopwood wrote:
>> Kevin Reid wrote:
>>> On Mar 15, 2007, at 23:43, David Hopwood wrote:
>>>
>>>> <http://erights.org/javadoc/org/erights/e/elib/tables/
>>>> FlexList.html>
>>>>
>>>> # void setRun(int start, int bound, EList other)
>>>> # Enabled: Replace from start..!bound in this list with other.
>>>>
>>>> ? def a := [2, 3, 4].diverge()
>>>> # value: [2, 3, 4].diverge()
>>>>
>>>> ? a.setRun(0, 0, [1])
>>>> ? a
>>>> # value: [1, 2, 3, 4].diverge()
>>>>
>>>> 1. Why is this called 'setRun'? 'insertRun' would make more sense.
>>>
>>> Note that the name "setRun" is part of the assignment sugar:
>>>
>>> a(b, c) := d
>>>
>>> expands to
>>>
>>> a.setRun(b, c, def ares__1 := d)
>>> ares__1
>>>
>>> , and a(b, c) is of course a.run(b, c).
>
> Oh, you mean that "Run" refers to the verb "to run". I had interpreted
> it as the noun "run" meaning a sublist, e.g. a run of cards. That's
> English for you :-)
I hadn't intended to say that in particular. E does make that pun,
however; "run" is used for both "running" a subroutine (function) and
taking a "run" (subsequence) of a collection.
But my point was that there is a sugar which expands to this
operation on lists, and that either the sugar must be changed to
match, the interface be duplicated, or the sugar removed (or no
longer be usable for this purpose).
Personally, I do not find the notion of "replacing" a subsequence
with a different-length subsequence at all odd, so I have no problem
with the replace/5 name. I wouldn't mind changing setRun/3 to
replaceRun/3 if we agree that it's an improvement and that it works
with non-list objects (or to discard the sugar connection);
"insertRun" I find to be wrong in the case where the specified range
is not zero-length.
--
Kevin Reid <http://homepage.mac.com/kpreid/>
More information about the e-lang
mailing list