Created
March 14, 2010 03:43
-
-
Save zahardzhan/331757 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns ack) | |
(in-ns 'ack) | |
(defn pow [x y] | |
(if (zero? y) 1 | |
(reduce * (repeat y x)))) | |
(defn up [a n b] | |
(cond (= n 1) (pow a b) | |
(= b 0) 1 | |
:else (recur a (dec n) | |
(up a n (dec b))))) | |
(defn a [m n] ;; not for all ms and ns | |
(cond (zero? n) (a (dec m) 1) | |
:else (- (up 2 (- m 2) (+ n 3)) 3))) | |
;; (a 4 3) - ? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment