I often employ this pattern in Ruby using `.tap` or a `begin` block. It barely adds any functionality but it's useful for readability because of the same reasons in the OP. It helps because I've been bitten by code that did this: setup_a = some_stuff setup_b = some_more_stuff i_think_this_is_setup = even_more_stuff the_thing = run_setup(setup_a, setup_b, i_think_this_is_setup) That's all fine until later on, probably…
let input = read_input(); let trimmed_input = input.trim(); let trimmed_uppercase_input = trimmed_input.uppercase();
...
The extra variable names are almost completely boilerplate and make it also annoying to reorder things.
In Clojure you can do
(-> (read-input) string/trim string/upcase)
And I find that so much more readable and refactorable.