|
@@ -60,4 +60,56 @@
|
|
|
(display x) (newline))
|
|
|
#(this is it))
|
|
|
|
|
|
+(eq? 'casa 'casa)
|
|
|
+(eq? "casa" "casa")
|
|
|
+(eqv? 2 2)
|
|
|
+(make-vector 5 'a)
|
|
|
+(equal? (make-vector 5 'a) (make-vector 5 'a))
|
|
|
+(equal? (make-vector 5 'a) (make-vector 5 'b))
|
|
|
+(eqv? (make-vector 5 'a) (make-vector 5 'a))
|
|
|
|
|
|
+(case (car(cdr '(c a)))
|
|
|
+ ((a e i o u) 'vowel)
|
|
|
+ ((w y) 'semivowel)
|
|
|
+ (else 'consonant))
|
|
|
+
|
|
|
+(cond ((> 3 2) 'greater)
|
|
|
+ ((< 1 3) 'less)
|
|
|
+ (else 'equal))
|
|
|
+
|
|
|
+(define (f)
|
|
|
+ (vector 1 2 3))
|
|
|
+(define v (f))
|
|
|
+(vector-set! v 0 20)
|
|
|
+(display v)
|
|
|
+
|
|
|
+(struct being (
|
|
|
+ name
|
|
|
+ (age #:mutable)
|
|
|
+ ))
|
|
|
+
|
|
|
+(define (being-show x)
|
|
|
+ (newline)
|
|
|
+ (display (being-name x))
|
|
|
+ (newline)
|
|
|
+ (display (being-age x)))
|
|
|
+
|
|
|
+(define james (being "James" 30))
|
|
|
+(being-show james)
|
|
|
+(set-being-age! james 40)
|
|
|
+(being-show james)
|
|
|
+
|
|
|
+(define (say-hello x)
|
|
|
+ (if (being? x)
|
|
|
+ (begin
|
|
|
+ (being-show x)
|
|
|
+ (newline)
|
|
|
+ (display "regards")
|
|
|
+ )
|
|
|
+ (error "not a being" x)))
|
|
|
+(say-hello james)
|
|
|
+
|
|
|
+(struct may-being being
|
|
|
+ ((alive? #:mutable)))
|
|
|
+(define john (may-being "John" 87 #t))
|
|
|
+(say-hello john)
|