Skip to content

Commit

Permalink
Add fibonacci test
Browse files Browse the repository at this point in the history
  • Loading branch information
muqiuhan committed Jul 31, 2022
1 parent 7e83573 commit dd98268
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/03_fibonacci.mlisp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; mlisp ;;
;; Copyright (C) 2022 Muqiu Han ;;
;; ;;
;; This program is free software: you can redistribute it and/or modify ;;
;; it under the terms of the GNU Affero General Public License as published ;;
;; by the Free Software Foundation, either version 3 of the License, or ;;
;; (at your option) any later version. ;;
;; ;;
;; This program is distributed in the hope that it will be useful, ;;
;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;
;; GNU Affero General Public License for more details. ;;
;; ;;
;; You should have received a copy of the GNU Affero General Public License ;;
;; along with this program. If not, see <https://www.gnu.org/licenses/>. ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun fib (x)
(if (or (= x 1) (= x 0))
x
(+ (fib (- x 1)) (fib (- x 2)))))

(fib 20)

0 comments on commit dd98268

Please sign in to comment.