Clojure例
```Clojure
; 線形再帰的
(defn expt [b n]
  (if (= n 0)
    1
    (* b (expt b (- n 1)))))
; 線形反復的
(defn expt-iter [b n]
  (defn iter [b counter product]
    (if (= counter 0)
      product
      (iter b
            (dec counter)
            (* b product))))
  (iter b n 1))
; 逐次平方
(defn fast-expt [b n]
  (cond (= n 0) 1
        (even? n) (square (fast-expt b (/ n 2)))
        :else (* b (fast-expt b (- n 1)))))
```