$ include "seed7_05.s7i"; const func type: stack (in type: baseType) is func result var type: stackType is void; begin stackType := array baseType; const proc: push (inout stackType: aStack, in baseType: top) is func begin aStack := [] (top) & aStack; end func; const func baseType: pop (inout stackType: aStack) is func result var baseType: top is baseType.value; begin if length(aStack) = 0 then raise RANGE_ERROR; else top := aStack[1]; aStack := aStack[2 ..]; end if; end func; const func boolean: empty (in stackType: aStack) is return length(aStack) = 0; end func; const type: intStack is stack(integer); const proc: main is func local var intStack: s is intStack.value; begin push(s, 10); push(s, 20); writeln(pop(s) = 20); writeln(pop(s) = 10); writeln(empty(s)); end func;