asolntsev

Untitled

Apr 5th, 2011
1,556
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;нечитабельный вариант
  2. (defun gen (x) (loop for i from 1 below (+ x 1) do (format t "~{~a~^-~}~%" (if (= (rem i 2) 0)  (reverse (loop for b from 1 below (+ i 1) append (list b))) (loop for b from 1 below (+ i 1) append (list b))))))
  3.  
  4. ;читабельный вариант
  5. CL-USER> (defun gen (x)
  6.            (loop for i from 1 below (+ x 1) do
  7.                 (format t "~{~a~^-~}~%" (if (= (rem i 2) 0)
  8.                     (reverse (loop for b from 1 below (+ i 1) append (list b)))
  9.                         (loop for b from 1 below (+ i 1) append (list b))))))
RAW Paste Data