anchor.diff:  #| Extensions to the lambda-calculus |#
   
   (defgeneric decode (expression type environment)
  -  (:documentation "Returns the Lisp object encoded by the expression in the environment, with type as a hint."))
  +  (:documentation "Returns as the primary value the Lisp object encoded by the expression in the environment, with type as a hint.
  +Secondary value is T if decoding was actually successful."))
  +
  +(defmethod decode (expression type environment)
  +  (values nil nil))
   
   (defmethod decode ((expression hidden-abstraction) type environment)
  -  (hid-name expression))
  +  (values (hid-name expression) t))
   
   (defmethod decode ((expression hidden-abstraction) (type (eql 'boolean)) environment)
  -  (read-from-string (render (normalize #'normal-order (make-expression (list expr t nil) nil))) nil))
  +  (values (read-from-string (render (normalize #'normal-order (make-expression (list expression t nil) nil))) nil) t))
   
   ;;;
   
  
positive.code: (defmethod applicative-order ((expression lisp-function))
    nil)
  
  (defmethod beta-reduce (variable value (expression lisp-function))
    (if (eq variable expression) ; cf. abs-var
        (let ((result (funcall (lisp-fun expression) value)))
  
negative.code:   (%type? expression type environment))
  
  (defmethod %type? (expression (type (eql 'numeral)) environment)
    (multiple-value-bind (value decoded?) (decode expression type environment)
      (when decoded?
        (typep value '(integer 0 *)))))
  
  (defmethod %type? (expression (type (eql 't)) environment)
    t)
  