home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / scheme / 2789 < prev    next >
Encoding:
Internet Message Format  |  1992-12-21  |  1.1 KB

  1. Path: sparky!uunet!dtix!darwin.sura.net!mlb.semi.harris.com!travis.csd.harris.com!grouper!!brent
  2. From: brent@ssd.csd.harris.com (Brent Benson)
  3. Newsgroups: comp.lang.scheme
  4. Subject: Re: Summary. Interpreters are faster than I thought
  5. Message-ID: <BRENT.92Dec18111727@amber.ssd.csd.harris.com>
  6. Date: 18 Dec 92 16:17:27 GMT
  7. References: <4094@mitech.com>
  8. Sender: news@grouper.mkt.csd.harris.com (Network News)
  9. Organization: Harris Computer Systems
  10. Lines: 24
  11. In-Reply-To: gjc@mitech.com's message of 17 Dec 92 12:21:03 GMT
  12.  
  13. gjc@mitech.com (George J. Carrette) writes:
  14.  
  15. > So here is another version of fib that uses binary arithmetic
  16. > implemented as lists of symbols.
  17.  
  18. The B< function is buggy.  It requires (cdr '()) to return '() and 
  19. (if #f foo) to return #f.  Here is a version that should work in R4RS
  20. implementations. 
  21.  
  22. (define (b< x y)
  23.   (cond
  24.    ((null? x) (not (null? y)))
  25.    ((null? y) #f)
  26.    (else (or (b< (cdr x) (cdr y))
  27.          (if (equal? (cdr x) (cdr y))
  28.          (if (eq? (car x) 'A)
  29.              (eq? (car y) 'B)
  30.              #f)
  31.          #f)))))
  32.  
  33.  
  34. --
  35. Brent Benson                     
  36. Harris Computer Systems
  37.