* module/mes/base.mes (closure_p, mes_car, mes_cdr): New function.
(pair_p): Closure is not a pair.
* NEWS: Mention it.
* psyntax-0.mes (self-evaluating?): Add closure?.
*** Lambda* and define* are now supported.
*** #;-comment is now supported.
*** Non-nested #| |#-comment is now supported.
*** Lambda* and define* are now supported.
*** #;-comment is now supported.
*** Non-nested #| |#-comment is now supported.
+** Noteworthy bug fixes
+*** Closure is not a pair.
* Changes in 0.3 since 0.2
** Core
*** Number-based rather than pointer-based cells.
* Changes in 0.3 since 0.2
** Core
*** Number-based rather than pointer-based cells.
(define (procedure? p)
(cond ((builtin? p) #t)
((and (pair? p) (eq? (car p) 'lambda)))
(define (procedure? p)
(cond ((builtin? p) #t)
((and (pair? p) (eq? (car p) 'lambda)))
- ((and (pair? p) (eq? (car p) '*closure*)))
(define annotation? (lambda (x) #f))
(define (self-evaluating? x)
(define annotation? (lambda (x) #f))
(define (self-evaluating? x)
- (or (boolean? x) (number? x) (string? x) (char? x) (null? x)))
+ (or (boolean? x) (number? x) (string? x) (char? x) (null? x) (closure? x)))
(define (void) (if #f #f))
(define (void) (if #f #f))
"noexpand")
(pass-if "closure 9" (sc-expand))))
"noexpand")
(pass-if "closure 9" (sc-expand))))
+(pass-if "closure is procedure"
+ (procedure? (lambda () #t)))
+
+(pass-if-not "closure is not a pair"
+ (pair? (lambda () #t)))
+
return TYPE (x) == CHAR ? cell_t : cell_f;
}
return TYPE (x) == CHAR ? cell_t : cell_f;
}
+SCM
+closure_p (SCM x)
+{
+ return (TYPE (x) == PAIR && CAR (x) == cell_closure) ? cell_t : cell_f;
+}
+
+SCM
+mes_car (SCM x)
+{
+ return CAR (x);
+}
+
+SCM
+mes_cdr (SCM x)
+{
+ return CDR (x);
+}
+
- return TYPE (x) == PAIR ? cell_t : cell_f;
+ return (TYPE (x) == PAIR && CAR (x) != cell_closure) ? cell_t : cell_f;