Skip to content

Instantly share code, notes, and snippets.

@thinkphp
Created May 29, 2013 09:52
Show Gist options
  • Select an option

  • Save thinkphp/5669206 to your computer and use it in GitHub Desktop.

Select an option

Save thinkphp/5669206 to your computer and use it in GitHub Desktop.
Converts a decimal to binar in Common Lisp
;Adrian Statescu <mergesortv@gmail.com>
;converts a decimal to binar
(defun toBin(N)
+
+ (let ((R))
+
+ (dotimes (i 15 R)
+
+ (setf bit (logand (ash N (- i)) 1))
+
+ (setf R (cons bit R))
+ )
+ )
+)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment