<commit_before>async function locateScalpel(nest) {
    let curNest = nest.name;
    for (;;) {
        let scalpelLoc = await anyStorage(nest, curNest, "scalpel");
        if (scalpelLoc == curNest) return curNest;
        curNest = scalpelLoc;
    }
}

function locateScalpel2(nest) {
    let next = nest.name;
    function getNext(next) {
        return anyStorage(nest, next, "scalpel")
            .then(val => val == next ? next : getNext(val));
    }
    return getNext(next);
}

locateScalpel(bigOak).then(console.log);
// → Butcher's Shop
locateScalpel2(bigOak).then(console.log);
// → Butcher's Shop<commit_msg>Add chapter 11, exercise 1<commit_after>async function locateScalpel(nest) {
	let current = nest.name;

	for (;;) {
		let next = await anyStorage(nest, current, "scalpel");
		if (next == current) {
			return next;
		}

		current = next;
	}
}

function locateScalpel2(nest) {
	function next(current) {
		return anyStorage(nest, current, "scalpel")
			.then(value => value == current ? value : next(value));
	}

	return next(nest.name);
}
{'fraction_non_alphanumeric': 0.14096499526963102, 'fraction_numerical': 0.005676442762535478, 'mean_word_length': 3.4641350210970465, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5376106', 'n_tokens_mistral': 384, 'n_tokens_neox': 357, 'n_words': 84}