A switch in a cage with a memory.
[structure: see text] Chemical and optical stimulations control the interconversion of a three-state molecular switch trapped inside a silica monolith. The resulting absorbance changes in the visible region can be exploited to reproduce a sequential logic operator with one optical input and one optical output. This strategy to transfer operating principles for digital processing from bulk solutions to rigid materials can lead to the development of chemical logic gates based on functional solid components.