lager icon indicating copy to clipboard operation
lager copied to clipboard

Allow mixing cursors and readers into a cursor node

Open Siapran opened this issue 4 years ago • 0 comments

Consider:

cursor<vector<T>> collection = ...;
reader<size_t> identifier = ...;

cursor<T> element = with(collection, identifier).xform(
	zug::map([](vector<T> vect, size_t index) -> T {
		return view(at(index), vect);
	}),
	lager::update([](tuple<vector<T>, size_t> whole, T part) -> vector<T> {
		return set(at(whole.second), whole.first, part);
	}));

Alternatively, converting a reader node into a cursor that discards any writes would be acceptable.

Siapran avatar Apr 29 '20 20:04 Siapran