blob: 461dc263fb79429280cd3213a4313db02e309924 (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
(define-module (language python bool)
#:use-module (oop goops)
#:use-module (language python exceptions)
#:use-module (oop pf-objects)
#:export (bool))
(define-syntax-rule (aif it p x y) (let ((it p)) (if it x y)))
(define-method (bool x)
(cond
((null? x)
#f)
((eq? x None)
#f)
(else x)))
(define-method (bool (x <integer>)) (not (= x 0)))
(define-method (bool (x <p>))
(aif it (ref x '__bool__)
(it)
(next-method)))
|