positive?
ใคใใใใ (> _ 0)
ใฎๆนใใใใใจใใ่ฉฑ(use srfi-1)
(for-each
(lambda (i)
(let1 j (- i 30000)
(if
;(positive? j)
(> j 0)
#t #f)
))
(iota 10000000))
็ผใ้ใๆณใใฃใฆใฆ๏ผ positive?ใฃใฆๅๅ้ทใใใใผใญใจใฎๅคงๅฐๆฏ่ผใซๆธใๆใใใๅฐๅณใซ้ใใชใฃใ
ใฆใฃใใ R5RS ใงๅฎ็พฉใใใฆใใใใใฎใใชใใใฃใใชๆ็ถใใ ใใ ๆ้ฉๅใใใฆใใใฎใ ใจๆใฃใใใฉๅฅใซใใใงใใชใใใ ใญ
positive?ใใ>ใฎใปใใๆฉใๅ ดๅใใใใใฉ๏ผใใใงใชใๅ ดๅใใใฃใ
(time (for-each (^i (if (positive? 1) 'true 'false)) (iota *N*)))
; real 0.155
; user 0.150
; sys 0.000
(time (for-each (^i (if (positive? -23) 'true 'false)) (iota *N*)))
; real 0.131
; user 0.130
; sys 0.000
(time (for-each (^i (if (> 1 0) 'true 'false)) (iota *N*)))
; real 0.140
; user 0.140
; sys 0.000
ๅฎๆฐใๅผๆฐใซใใฆใใใใใใชใใงใใ
(time (for-each (^i (if (positive? i) 'true 'false)) (iota *N*)))
; real 0.166
; user 0.160
; sys 0.000
(time (for-each (^i (if (> i 0) 'true 'false)) (iota *N*)))
; real 0.141
; user 0.140
; sys 0.000
ใใ๏ผใใฃใฑใ positive?
ใใ >
ใฎใๆฉใ
ใใฏใญใซใใใฎใ่ฏใใช
(define-macro (positive? x) `(> ,x 0))