数値
p.155の
・整数(例: 100、3.0)
となってるのの3.0って3の間違い?
gosh> (class-of 3) #<class <integer>> gosh> (class-of 3.0) #<class <real>>
二進数とか。
gosh> #b101010101010
2730
バイナリアンにはありがたい。
ほかに
#o | octal | |
#d | decimal | |
#x | hexdecimal | |
#e | exact number | |
#i | inexact number |
とかあるみたい。 #eに実数与えたらってやってみたら rationalに変換された。
gosh> #e10.3234 51617/5000 gosh> (/ 51617.0 5000.0) 10.3234
なるほど。
gosh> (class-of (inexact->exact 1.232)) #<class <rational>>
gosh> (exact? 3) #t gosh> (exact? 3+3i) #f
複素数はreal, imagが整数でも不正確数なんだ...
複数の値の大小比較便利!
gosh> (define ans 30) ans gosh> (< 1 ans 100) #t
僕はCとかで
if (0< ans && 100>ans) { ... }
とか書かれると混乱する程度にバカなので。
http://d.hatena.ne.jp/tkuro/20080913/1221269155