情報科学概論IIA 電子・情報工学系 新城 靖 <yas@is.tsukuba.ac.jp>
このページは、次の URL にあります。
http://www.hlla.is.tsukuba.ac.jp/~yas/coins/Joka2a-1998/1998-04-21
あるいは、次のページから手繰っていくこともできます。
http://www.hlla.is.tsukuba.ac.jp/~yas/coins/
http://www.hlla.is.tsukuba.ac.jp/~yas/index-j.html
1 1000000000000000000000000000000000000 1.0 1/3長い整数。浮動少数。分数。
(+ 1 2) (+ 1 2 (* 3 4))
(if (< 1 0) (- 1) 1) (if (< -10 0) (- -10) -10)- は、1引数と2引数で動きが違う。
(define (abs x) (if (< x 0) (- x) x))
(define (abs x) (cond ((< x 0) (- x)) ((= x 0) 0) ((> x 0) x))) (define (abs x) (cond ((< x 0) (- x)) ((= x 0) 0) (else x)))
'(a b c) (car '(a b c)) (cdr '(a b c)) (cons 'a '(b c)) (append '(a) '(b c)) (list 'a 'b 'c) 'a '(a) (list '(a) '(b) '(c)) (cons '(a) '(b c)) (append 'a '(b c))
struct s1 { int x ; int y ; int z ; }; '(10 20 30) (define x '(10 20 30)) x (car x) (cdr x) (car (cdr x)) (car (cdr (cdr x))) (define (make-struct-s1 x y z) (list x y z)) (define (get-x s) (car s)) (define (get-y s) (car (cdr s))) (define (get-z s) (car (cdr (cdr s)))) (define a (make-struct-s1 1 2 10)) (get-x a) (get-y a) (get-z a)
(list 1 2)和、差、内積、大きさを求める手続きを定義しなさい。