Browse files

while macro and make-alphanum-password snippet.

  • Loading branch information...
1 parent d42d54e commit ee5e032f0b481de4e70ea387699634b37a945968 @mikaelj committed Aug 18, 2009
Showing with 19 additions and 0 deletions.
  1. +12 −0 lisp/make-alphanum-password.lisp
  2. +7 −0 lisp/while.lisp
View
12 lisp/make-alphanum-password.lisp
@@ -0,0 +1,12 @@
+(defun make-password (length)
+ (let ((capital (char-code #\A))
+ (small (char-code #\a))
+ (number (char-code #\0)))
+ (coerce (loop for i from 0 to length
+ and p = (random 3)
+ when (= p 0) collect (code-char (+ capital (random 26)))
+ when (= p 1) collect (code-char (+ small (random 26)))
+ when (= p 2) collect (code-char (+ number (random 10))))
+ 'string)))
+
+(make-password 8)
View
7 lisp/while.lisp
@@ -0,0 +1,7 @@
+defmacro while (test &rest body)
+ `(loop while ,test do ,@body))
+
+(defvar *foo* 0)
+(while (< *foo* 10)
+ (format t "foo: ~A~%" *foo*)
+ (incf *foo*))

0 comments on commit ee5e032

Please sign in to comment.