simplified private list.range() method

pull/95/head
jmoenig 2021-02-07 10:14:40 +01:00
rodzic 5be843596b
commit ed231aad5f
3 zmienionych plików z 9 dodań i 6 usunięć

Wyświetl plik

@ -9,6 +9,9 @@
* **Documentation Updates:**
* updated manual (e.g. p.20) with hyper-semantics of ITEM OF, thanks Brian
### 2021-02-06
* simplified private list.range() method
### 2021-02-05
* new manual for v6.6, thanks, Brian!
* objects: don't show internal "compile" reporter in search results

Wyświetl plik

@ -13,7 +13,7 @@
<script src="src/objects.js?version=2021-01-30"></script>
<script src="src/gui.js?version=2021-02-04"></script>
<script src="src/paint.js?version=2020-05-17"></script>
<script src="src/lists.js?version=2021-02-04"></script>
<script src="src/lists.js?version=2021-02-07"></script>
<script src="src/byob.js?version=2020-12-22"></script>
<script src="src/tables.js?version=2020-10-06"></script>
<script src="src/sketch.js?version=2020-07-13"></script>

Wyświetl plik

@ -63,7 +63,7 @@ MorphicPreferences, TableDialogMorph, SpriteBubbleMorph, SpeechBubbleMorph,
TableFrameMorph, TableMorph, Variable, isSnapObject, Costume, contains, detect,
ZERO, WHITE*/
modules.lists = '2021-February-04';
modules.lists = '2021-February-07';
var List;
var ListWatcherMorph;
@ -409,7 +409,7 @@ List.prototype.query = function (indices) {
first = indices.at(1);
if (first instanceof List) {
select = first.isEmpty() ?
this.range(1, this.length())
this.range(this.length())
: first;
} else {
select = new List([first]);
@ -419,9 +419,9 @@ List.prototype.query = function (indices) {
);
};
List.prototype.range = function (start, end) {
// private - answer a list of ascending numbers, incremented by 1
return new List([...Array(end - start + 1)].map((e, i) => i + start));
List.prototype.range = function (upTo) {
// private - answer a list of integers from 1 up to the given ceiling
return new List([...Array(upTo)].map((e, i) => i + 1));
};
List.prototype.items = function (indices) {