14 lines
307 B
JavaScript
Executable File
14 lines
307 B
JavaScript
Executable File
|
|
function collection() {
|
|
// initially empty collection
|
|
this.forall = function forall_base (f) { };
|
|
|
|
// allow adding items
|
|
this.add = function collection_add (new_item) {
|
|
var oldforall = this.forall;
|
|
this.forall = function forall_elt (f) {
|
|
oldforall(f);
|
|
f(new_item);
|
|
};
|
|
};
|
|
} |