# Lesson VII Nothing is painted, yet the stroke is already shaped. The brush will reveal it in time. ## Try ```prolog ?- infer([push(quote([dup, add]))], Effect). Effect = effect(S, [quote(effect([int|T], [int|T]))|S]). ?- run([push(quote([dup, add]))], [], Stack). Stack = [quote([dup, add])]. ``` ## Learn Quotations need a type that can be stored as data. `infer/3` relation can answer a query about one chosen input and output stack, but it does not package the whole effect as a single value. Replace the public inference shape with `effect(In, Out)`, so quote values can carry the suspended stack transition their body will require when called. > [!info]- Change > ```diff > - infer([], Stack, Stack). > - infer([Word|Words], Stack0, Stack) :- > - infer1(Word, Stack0, Stack1), > - infer(Words, Stack1, Stack). > ``` A quotation is valid when its body has a static stack effect. ```prolog infer([], effect(Stack, Stack)). infer([Word|Words], effect(Stack0, Stack)) :- infer1(Word, Stack0, Stack1), infer(Words, effect(Stack1, Stack)). lit(quote(Words), quote(effect(In, Out))) :- infer(Words, effect(In, Out)). ``` [[06_lesson|Prev]] | [[08_lesson|Next]]