WIP (fixed conv)
This commit is contained in:
parent
4e3ea1a878
commit
4f47fd99a0
1 changed files with 2 additions and 3 deletions
|
@ -4,12 +4,10 @@
|
|||
|
||||
(in-package :all-your-base)
|
||||
|
||||
; conv converts a list representation to base 10 number
|
||||
; This is complete but incorrect
|
||||
(defun conv (l base)
|
||||
(if (null l)
|
||||
0
|
||||
(+ (* (first l) (expt base (- (length l) 1)) (conv (rest l) base)))))
|
||||
(+ (* (first l) (expt base (- (length l) 1))) (conv (rest l) base))))
|
||||
|
||||
(defun calc-start-exponent (num base x)
|
||||
(if (< num (expt base (1+ x)))
|
||||
|
@ -28,4 +26,5 @@
|
|||
(append (list q) (unconv r base (- x 1)))))))
|
||||
|
||||
(defun rebase (l source destination)
|
||||
(print (list l source destination))
|
||||
(unconv (conv l source) destination -1))
|
||||
|
|
Loading…
Add table
Reference in a new issue