home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / scheme / 2826 < prev    next >
Encoding:
Text File  |  1992-12-25  |  1.4 KB  |  47 lines

  1. Newsgroups: comp.lang.scheme
  2. Path: sparky!uunet!mcsun!Germany.EU.net!news.Hamburg.Germany.EU.net!malihh!clu
  3. From: clu@malihh.hanse.de (Carsten Lutz)
  4. Subject: Re: applying or
  5. Message-ID: <BztK4w.1Lt@malihh.hanse.de>
  6. Organization: malihh, Hamburg, Germany
  7. References: <BztJDI.1J1@malihh.hanse.de>
  8. Date: Fri, 25 Dec 1992 14:26:53 GMT
  9. Lines: 36
  10.  
  11. In <BztJDI.1J1@malihh.hanse.de>, I write:
  12. >I tried to write a little procedure which implements an "or"-function but
  13. >additionally checks if it's arguments are booleans. My approach was the
  14. >following:
  15. >
  16. > (define (b-or . oplist)
  17. >   (if (boollist? oplist)
  18. >       (apply or oplist)
  19. >       'not-a-bool))
  20. I forgot about two things:
  21.  
  22. First to give the procedure boollist?, which is pretty trivial:
  23.  
  24.   (define (boollist? list)
  25.     (cond ((null? list) #t)
  26.           ((boolean? (car list)) (boollist? (cdr list)))
  27.           (else #f)))
  28.         
  29. And second of course I know a way to write my procedure b-or:
  30.  
  31. (define (b-or . oplist)
  32.   (cond ((null? oplist) #f)
  33.         ((not (boolean? (car oplist))) 'not-a-bool)
  34.         ((eq? (car oplist) #t))
  35.         (else (apply b-or (cdr oplist)))))
  36.  
  37. I'm only interested in this apply/syntactic keyword-problem 'cause it
  38. doesn't make sense to me that I can't apply an or.
  39.  
  40. greetings,
  41.         Carsten
  42.  
  43.  
  44. -- 
  45. * Carsten Lutz, Rellingen, FRG / clu@malihh.hanse.de ( NeXTmail accepted )  *
  46. *   Voice : +49 4101 512493  Fax: +49 4101 27757  Traily : +49 4101 22306   *
  47.