home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.scheme
- Path: sparky!uunet!mcsun!Germany.EU.net!news.Hamburg.Germany.EU.net!malihh!clu
- From: clu@malihh.hanse.de (Carsten Lutz)
- Subject: Re: applying or
- Message-ID: <BztK4w.1Lt@malihh.hanse.de>
- Organization: malihh, Hamburg, Germany
- References: <BztJDI.1J1@malihh.hanse.de>
- Date: Fri, 25 Dec 1992 14:26:53 GMT
- Lines: 36
-
- In <BztJDI.1J1@malihh.hanse.de>, I write:
- >I tried to write a little procedure which implements an "or"-function but
- >additionally checks if it's arguments are booleans. My approach was the
- >following:
- >
- > (define (b-or . oplist)
- > (if (boollist? oplist)
- > (apply or oplist)
- > 'not-a-bool))
- I forgot about two things:
-
- First to give the procedure boollist?, which is pretty trivial:
-
- (define (boollist? list)
- (cond ((null? list) #t)
- ((boolean? (car list)) (boollist? (cdr list)))
- (else #f)))
-
- And second of course I know a way to write my procedure b-or:
-
- (define (b-or . oplist)
- (cond ((null? oplist) #f)
- ((not (boolean? (car oplist))) 'not-a-bool)
- ((eq? (car oplist) #t))
- (else (apply b-or (cdr oplist)))))
-
- I'm only interested in this apply/syntactic keyword-problem 'cause it
- doesn't make sense to me that I can't apply an or.
-
- greetings,
- Carsten
-
-
- --
- * Carsten Lutz, Rellingen, FRG / clu@malihh.hanse.de ( NeXTmail accepted ) *
- * Voice : +49 4101 512493 Fax: +49 4101 27757 Traily : +49 4101 22306 *
-