Heat pump is a refrigerator? There is the following problem in a textbook on Thermodynamics:

A heat pump is an electrical device that heats a building by pumping heat in from the cold outside. In other words, it’s the same as a refrigerator, but its purpose is to warm the hot reservoir rather than to cool the cold reservoir (even though it does both).

I have a hard time understanding the principal difference between a heat pump and a refrigerator. In a refrigerator, heat is drawn from a cold substance into the refrigerator cabin and then excess heat is pumped out of the device.
Now, in the case of a heat pump, heat is also pumped from a "cold substance" (the cold outside) and it goes into the "cabin" (the building interior). But then how does the building get heated and not refrigerated? I'm really confused by this problem statement, it couldn't be less clear.
 A: The principal difference between a heat pump and a refrigerator is a matter of perspective. A heat pump is simply a refrigerator where the inside of the refrigerator is outside the house. In other words, a heat pump attempts to cool down the air outside the building, and in the process heats up the air inside the building.
Put differently, a refrigerator is simply a heat pump which takes heat from inside the refrigerator and transfers it outside the refrigerator.
A: I think that part of your confusion stems from the fact that the statement you highlighted is rather poorly phrased.  A couple of fact that might clarify things:
1.) a heat pump is a fancy science word for any refrigeration device or unit, be it a kitchen refrigerator, air conditioner, "swamp box" or anything else.  I'm not sure why the author of the quote is drawing some kind of difference between a refrigerator and a heat pump.  (Somebody correct me if I'm wrong on this point).
2.)  Somewhere in your quote, the author seems confused about how "heat pumps" are normally configured.  Every "heat pump" I've ever seen in the real world was used to cool off a room or the inside of a freezer, etc.  
3.)  Lastly, every device whose authentic purpose was to heat a room was called a heater.  (My sarcasm is aimed at the author of the quote, not you SEQUENCE).  Granted, a traditional food refrigerator may incidentally heat a room up by cooling off the inside of the "cabin", but this is incidental, and should be presented as such.
I agree that the author couldn't be less clear.  The author seems to need to re-write this section of the book.
A: Although other people focused on the fact that when performing a single operation they are essentially the same, no-one has pointed out that heat pumps are often built to be reversible, i.e. they can be used both to cool down and to warm up an environment (they are easily switchable between those two configurations). Refrigerators are built to perform just that function.
See also the relevant Wikipedia article on heat pumps.
In particular this excerpt (emphasis mine):

Heat energy naturally transfers from warmer places to colder spaces. However, a heat pump can reverse this by absorbing heat from a cold space and releasing it to a warmer one. Heat is not conserved in this process and requires some amount of external energy such as electricity. In heating, ventilation and air conditioning (HVAC) systems, the term heat pump usually refers to vapor-compression refrigeration devices optimized for high efficiency in both directions of thermal energy transfer. These heat pumps can be reversible, and work in either direction to provide heating or cooling to the internal space.

Bottom line: from an engineering perspective, an heat pump can be easily reconfigured either to warm up or cool down the conditioned area, whereas a refrigerator can't. 
A: Before answering the question let's talk about the word "efficiency".
In the meaning we care about here the word is used to described the effectiveness with which some consumed resource is converted into some desired effect. In the context of thermodynmanic engines, refrigerators and heat pumps the desired outcome and the available resource are one of


*

*heat moved between the warm source and the mechanism

*heat moved between the cold source and the mechanism

*work (done by or on the mechanism)


all three of which are denominated in terms of energy, so we use a ratio
$$ \text{efficiency} = \frac{\text{desired outcome (in energy)}}{\text{resource used(in energy)}} \;.$$
In an engine we feed energy in (heat from the hot reservoir to the engine, and get work out, so
$$ \text{efficiency}_\text{engine} = \frac{\text{work done}}{\text{heat supplied}} \;.$$
In the case of a either refrigerator or a heat pump supplied work is the resource used up, but the desired outcome varies: for refrigeration you care about heat removed from the cold source, while in a heat pump you care about the heat added to the hot source. (For historical reasons we also use the phrase "coefficient of performance" instead of "efficiency", here.)
\begin{align*}
\text{CoP}_\text{refrigerator} &= \frac{\text{heat removed}}{\text{work supplied}} \\
\\
\text{CoP}_\text{heat pump} &= \frac{\text{heat supplied}}{\text{work supplied}} \;.
\end{align*} 
So, to finally put the answer in words, the only difference is what you are trying to accomplish.
