next up previous contents
Next: Comparing two numbers: `gtp' Up: Relational Abstractions Previous: Relational Abstractions   Contents

Comparing two numbers: `equaln'

This abstraction can only be used to compare Church Numerals. To compare other objects like symbols, strings or closures `equalx' has to be used, one of the primitive functions introduced by the extension of A++.

(define equaln 
   (lambda (m n)
      (land (zerop (sub m n))
         (zerop (sub n m)))))

(bdisp! (equaln two three))
                             --> false
(bdisp! (equaln two two))
                             --> true

Georg P. Loczewski 2004-03-05

Impressum und Datenschutz