esx_raptor wrote:Excuse me? I'm a C programmer, man, and I'm pretty sure I know what those are.
Well, that certainly wasn't clear from the original post, and the term "integer concatenation" somewhat indicated that you do not, even in scare quotes.
My point is, "binary" and "decimal" are properties of representation. Therefore conversion from decimal to binary cannot operate on integers, since integers are not "decimal". In Lisp the number read base is even configurable
. Therefore, an argument to such a converter would have to be a sequence of digits, and the output likewise. Incidentally, there was no indication that you wanted to output such a sequence to standard output, either.
An example implementation of what I meant:
Code: Select all
(defun dtb (decimal)
(let ((decimal-vector (coerce decimal '(vector (integer 0 9)))))
(if (zerop (length decimal-vector))
(let ((anumber (loop for d from (1- (length decimal-vector)) downto 0
for f = 1 then (* 10 f)
summing (* (aref decimal-vector d) f))))
(reverse (loop for number = anumber then (floor number 2)
while (plusp number)
collect (mod number 2)))))))
esx_raptor wrote:"How To Display Something in LISP to Standard Output? (Terminal?)"
There are rather many ways
, and that is even without getting into formatted output