(written from a Production point of view)
According to the Star Trek: The Motion Picture shooting script, a scrap metal compactor was a mechanical device aboard the refitted USS Enterprise which was used for compacting scrap metal. After the Ilia probe remarked that it was illogical for carbon-based units to have control over the starship's power systems, Chief Engineer Montgomery Scott retorted, "Lassie, if I was functioning 'logically', right now I'd be showing you the inside of our scarp metal compactor!" This scene was cut from the theatrical film.
While referring to this scene, James Doohan once expressed his dismay of being unable show his comedic personality through his role of Scotty. Had Doohan had his way, this scene was one that he wanted to have preserved in the final print. In Doohan's own words, "There was a great scene when Ilia, who has become a robot, is inspecting the engine room. She's walking down the walkway from way in the back–and those gorgeous legs! I'm just standing there, you know, and I forget all about acting! She comes up past Scotty and stops and says to Decker, 'It is illogical that this carbon-based until should be in charge of warp engines.' And I lean across my console to her and say (leeringly), 'Lassie, if I were being logical right now, I'd be showin' you the inside of a trash metal compactor!' It's unfortunate that they didn't use that scene." (Starlog #94, May 1985, p. 27)