Balanced brackets: Difference between revisions

m
Reduced some redundant expressions in the section of Common Lisp
m (Reduced some redundant expressions in the section of Common Lisp)
Line 1,722:
<lang lisp>
(defun string-of-brackets (n)
(let* ((result (make-stringlen (* 2 n)))
(res (openingmake-string nlen))
(closingopening (/ len n2))
(dotimes (iclosing (*/ 2len n2)) result)
(setfdotimes (arefi resultlen ires)
(setf (aref res (condi)
(cond ((zerop opening) #\])
((zerop closing) #\[)
(t (if (= (random 2) 0)
(progn (decf opening) #\[)
(progn (decf closing) #\]))))))))
 
(defun balancedp (string)
Anonymous user