Mechanical metamaterials exhibit a wide range of unusual properties, including negative response, cloaking, topological insulation and programmability. Such materials consist of periodic stackings of unit cells, where the unit cell design encodes the materials functionality. This periodicity limits their potential, as these metamaterials exhibit a homogeneous response. Here we introduce a combinatorial strategy to create an astronomical number of distinct, three-dimensional mechanical metamaterials. These materials consist of aperiodic stackings of soft anisotropic unit cells, and their functionality results from both the unit cell and the stacking order. We create such metamaterials by 3D printing, and experimentally demonstrate that the information embedded in the stacking order spawns completely novel properties. First, their surfaces can morph into an arbitrary texture. Second, they can mechanically recognize and analyze the surface texture they are in contact with. Our combinatorial approach opens pathways for the design of functional structures programmed with specific mechanical tasks, which blur the boundary between material and machine.