160 likes | 309 Views
Riadenie procesného toku. (prog1 1 2 3 4) (prog2 1 2 3 4) (progn 1 2 3 4) (let () 1 2 3 4). Riadenie procesného toku. (if (< 3 4) 4 3) (if (> 3 4) 4 3) (if (/= 3 0) 3) (if (= 3 0) 3) (if t (progn (print "ok") 7)). Riadenie procesného toku. (when t (print "ok") 7)
E N D
Riadenie procesného toku • (prog1 1 2 3 4) • (prog2 1 2 3 4) • (progn 1 2 3 4) • (let () 1 2 3 4)
Riadenie procesného toku • (if (< 3 4) 4 3) • (if (> 3 4) 4 3) • (if (/= 3 0) 3) • (if (= 3 0) 3) • (if t (progn (print "ok") 7))
Riadenie procesného toku • (when t (print "ok") 7) • (when (and t nil) (print "ok") 7) • (macroexpand-1 '(when t (print "ok") 7)) (IF T (PROGN (PRINT "ok") 7)) (COND (T NIL (PRINT "ok") 7))
Riadenie procesného toku • (unless (not t) (print "ok") 7) • (unless (or nil t) (print "ok") 7) • (macroexpand-1 '(unless t (print "ok") 7)) (IF (NOT T) (PROGN (PRINT "ok") 7)) (COND ((NOT T) NIL (PRINT "ok") 7))
Riadenie procesného toku • (cond ( (< -1 0) (print "menej ako nula") (- -1)) (nil) (t 0)) • (cond ( (> -1 0) (print "menej ako nula") (- -1)) (nil) (t 0)) • (cond (nil)) • (cond)
Riadenie procesného toku • (case (+ 3 4) (0 (print "nula") 0) (4) (t 99)) • (case (+ 3 -3) (0 (print "nula") 0) (4) (t 99)) • (case (+ 3 1) (0 (print "nula") 0) (4) (t 99))
Riadenie procesného toku • (macroexpand-1 '(case (+ 1 1) (1 2 3) (4))) (LET ((#:CASE-KEY-30909 (+ 1 1))) (COND ((EQL #:CASE-KEY-30909 '1) 2 3) ((EQL #:CASE-KEY-30909 '4))))
Riadenie procesného toku • (case (+ 3 4) (1 1) (2 3)) • (ccase (+ 3 4) (1 1) (2 3)) • (ecase (+ 3 4) (1 1) (2 3))
Riadenie procesného toku • (typecase '() (list "list") (number "number")) • (typecase '#() (list "list") (number "number")) • (ctypecase '#() (list "list") (number "number")) • (etypecase '#() (list "list") (number "number"))
Riadenie procesného toku • (macroexpand-1 '(typecase nil (list 0 1))) (LET ((#:G30916 NIL)) (COND ((TYPEP #:G30916 'LIST) 0 1)))
Riadenie procesného toku • (do (x (y 6) (z 0 (1+ z))) ((< y z) (print "koniec") (list x y z)) (setf x z) (decf y)) • (do* ((z 0 (1+ z)) (x z)) ((< 3 z)))
Riadenie procesného toku • (macroexpand-1 '(do ((z 0 (1+ z))) ((< 3 z)))) (BLOCK NIL (LET ((Z 0)) (TAGBODY #:G30925 (IF (< 3 Z) (GO #:G30926)) (PSETQ Z (1+ Z)) (GO #:G30925) #:G30926 (RETURN-FROM NIL (PROGN)))))
Riadenie procesného toku • (dolist (x '(1 2 3 4)) (print x) (1- x)) • (dolist (x '()) (= x 0)) • (dolist (x '(1 2 3 4) x) (print x) (1- x)) • (let ((y 0)) (dolist (x '(1 2 3 4) y) (incf y x)))
Riadenie procesného toku • (macroexpand-1 '(dolist (x '(1 2 3)) (= x 0))) (DO* ( (#:G30947 '(1 2 3) (CDR #:G30947)) (X NIL)) ((ENDP #:G30947) NIL) (DECLARE (LIST #:G30947)) (SETQ X (CAR #:G30947)) (= X 0))
Riadenie procesného toku • (dotimes (x 5) (print x) t) • (dotimes (x 0) (print x) t) • (let ((y 0)) (dotimes (x 5 y) (incf y x)))
Riadenie procesného toku • (macroexpand-1 '(dotimes (x 5) (= x 0))) (DO ((X 0 (1+ X))) ((>= X 5) NIL) (= X 0))