pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

teenlinux private pastebin - collaborative debugging tool What's a private pastebin?


Posted by free-zombie on Mon 27 Oct 22:37
report abuse | View followups from free-zombie | download | new post

  1. (defun with-unique-digits (to)
  2.   (let ((ndigits (ceiling (log to 10))))
  3.     (find-uniques to () ndigits 0)
  4.     ))
  5.  
  6.  
  7. (defun find-uniques (max forbidden ndigits add)
  8.   (cond
  9.     ((> add max) ())
  10.     ((= ndigits 0) (list add))
  11.     (t (append
  12.         (if (member 0 forbidden) ()
  13.             (find-uniques max (and forbidden (cons 0 forbidden)) (1- ndigits) add))
  14.         (loop for i from 1 to 9
  15.          append (if (member i forbidden) ()
  16.                  (find-uniques max (cons i forbidden) (1- ndigits)
  17.                                (+ add (* i (expt 10 (1- ndigits))))))
  18.              )
  19.          ))
  20.     ))

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me so that I can delete my post