RosettaCodeData/Task/Exponentiation-operator/Racket/exponentiation-operator.rkt

9 lines
135 B
Racket
Raw Permalink Normal View History

2013-06-05 21:47:54 +00:00
#lang racket
(define (^ base expt)
(for/fold ((acum 1))
((i (in-range expt)))
(* acum base)))
(^ 5 2) ; 25
(^ 5.0 2) ; 25.0