From: David Vazquez Date: Sun, 16 Dec 2012 22:08:44 +0000 (+0000) Subject: Remove loops X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=d9ea3b1c765af784880b5cdfd28b48e521716478;p=jscl.git Remove loops --- diff --git a/lispstrack.lisp b/lispstrack.lisp index 151036d..234750a 100644 --- a/lispstrack.lisp +++ b/lispstrack.lisp @@ -60,19 +60,23 @@ (or (char= ch #\space) (char= ch #\newline) (char= ch #\tab))) (defun skip-whitespaces (stream) - (loop for ch = (%peek-char stream) - while (and ch (whitespacep ch)) - do (%read-char stream))) + (let (ch) + (setq ch (%peek-char stream)) + (while (and ch (whitespacep ch)) + (%read-char stream) + (setq ch (%peek-char stream))))) (defun terminalp (ch) (or (null ch) (whitespacep ch) (char= #\) ch))) (defun read-until (stream func) - (let ((string "")) - (loop for ch = (%peek-char stream) - until (funcall func ch) - do (setq string (concat string (string ch))) - do (%read-char stream)) + (let ((string "") + (ch)) + (setq ch (%peek-char stream)) + (while (not (funcall func ch)) + (setq string (concat string (string ch))) + (%read-char stream) + (setq ch (%peek-char stream))) string)) (defun skip-whitespaces-and-comments (stream)