Skip to content

Commit 2effabb

Browse files
♻️ refactor(Single): element -> value, this.element -> this.a
1 parent 0242927 commit 2effabb

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/3-tree/implementations/1-Single.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import {Empty, Deep} from '.';
33
import {_EMPTY, cache, Split} from '../../0-core';
44
import {One} from '../../1-digit';
55

6-
export function Single(M, element) {
6+
export function Single(M, value) {
77
this.M = M;
8-
this.element = element;
9-
this.v = M.measure(element);
8+
this.a = value;
9+
this.v = M.measure(value);
1010
}
1111

1212
Single.prototype = new Tree();
@@ -20,11 +20,11 @@ Single.prototype.empty = function () {
2020
};
2121

2222
Single.prototype.head = function () {
23-
return this.element;
23+
return this.a;
2424
};
2525

2626
Single.prototype.last = function () {
27-
return this.element;
27+
return this.a;
2828
};
2929

3030
Single.prototype.tail = function () {
@@ -40,32 +40,32 @@ Single.prototype.cons = function (value) {
4040
this.M,
4141
new One(value),
4242
new Empty(cache(this.M)),
43-
new One(this.element)
43+
new One(this.a)
4444
);
4545
};
4646

4747
Single.prototype.push = function (value) {
4848
return new Deep(
4949
this.M,
50-
new One(this.element),
50+
new One(this.a),
5151
new Empty(cache(this.M)),
5252
new One(value)
5353
);
5454
};
5555

5656
Single.prototype.concat = function (other) {
57-
return other.cons(this.element);
57+
return other.cons(this.a);
5858
};
5959

6060
Single.prototype[Symbol.iterator] = function* () {
61-
yield this.element;
61+
yield this.a;
6262
};
6363

6464
/**
6565
* It is assumed that p(|this|) is true.
6666
*/
6767
Single.prototype.splitTree = function (p, i) {
68-
return new Split(new Empty(this.M), this.element, new Empty(this.M));
68+
return new Split(new Empty(this.M), this.a, new Empty(this.M));
6969
};
7070

7171
Single.prototype.split = function (p) {

0 commit comments

Comments
 (0)