function U( opr:symbol; v:Value ):Value; { U :Value -> Value } {PRE: v^.tag <> deferval} begin case opr of minus: if v^.tag=intval then U:=mkint(-v^.n) else error('- non int '); notsy: if v^.tag=boolval then U:=mkbool(not v^.b) else error('not ~bool '); hdsy: if v^.tag=listval then begin force(v^.hd); U:=v^.hd end else error('hd ~list '); tlsy: if v^.tag=listval then begin force(v^.tl); U:=v^.tl end else error('tl ~list '); nullsy:if v^.tag=listval then U:=mkbool(false) else if v^.tag=nilval then U:=mkbool(true) else error('null ~list') end end {U}; {\fB Execute Unary Operators \fP}