guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

About the primitive macros `and' and `or'


From: Yi DAI
Subject: About the primitive macros `and' and `or'
Date: Fri, 25 Dec 2009 13:18:01 +0800

Hi,


I don't see the point why Scheme provides the general `and' and `or' as primitive macros (which does stand in our way when we wanna (apply and things) instead of primitive procedures. For efficiency? I don't think there would be much compared to the following definitions:

(define (gand . l)  ; 'g'eneral 'and'
  (define (iand l)
    (if (null? l)
        #t
        (let ((b (car l))
              (bs (cdr l)))
          (cond ((null? bs) b)
                (b (iand bs))
                (else #f)))))
  (iand l))

(define (gor . l)  ; 'g'eneral 'or'
  (define (ior l)
    (if (null? l)
        #f
        (let ((b (car l))
              (bs (cdr l)))
          (cond ((null? bs) b)
                (b b)
                (else (ior bs))))))
  (ior l))


If anyone can give a reasonable explanation, I may buy it. Otherwise, I will go with my version in the future. And I suggest Guile or the standard committee fix this annoying `bug' of Scheme.

Finally, Merry Christmas and Happy New Year to all us Guile users, and Guile developers. We look forward the final 2.0 release of Guile in the coming new year.



Best wishes,




--
DAY

reply via email to

[Prev in Thread] Current Thread [Next in Thread]