読者です 読者をやめる 読者になる 読者になる

by shigemk2

当面は技術的なことしか書かない

hello, world

gosh Scheme

SICP P28から。

(print "Hello, World")

(define (square x) (* x x))
(define (smallest-divisor n)
  (find-divisor n 2))

(define (find-divisor n test-divisor)
  (cond ((> (square test-divisor) n) n)
        ((divides? test-divisor n) test-divisor)
        (else (find-divisor n (+ test-divisor 1)))))

(define (divides? a b)
  (= (remainder b a) 0))

(print (square 4))
(print (smallest-divisor 3000))