lisp - why `and` operator in scheme is not an built-in procedure -
i utilize chicken scheme interpreter, , when type not, returns #<procedure (not x295)>, when tried and , or, returns error: unbound variable: and.
it seems and operator not built-in procedure, why different not?
and if true, how (and #t #f) evaluated?
and , or "short-circuit operators" - not evaluate more necessary result formed, if , cond. example:
(and #f (display "foo")) will not display anything, , neither this:
(or #t (display "foo")) it impossible procedures, because phone call procedure evaluate arguments before procedure entered:
(define (proc-or x y) (if x #t (if y #t #f))) (proc-or #t (display "foo")) ; displays "foo" anyway a special form if (or, indeed, or) can decide parameters wishes evaluate. refer scheme manual regarding conditional operators, or more special forms (e.g. mit scheme, racket...)
more specifically, or , and either primitive forms (like if), or macros translate operator sequence of primitive forms.
scheme lisp
No comments:
Post a Comment