1 / 16

Riadenie procesného toku

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)

charla
Download Presentation

Riadenie procesného toku

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Riadenie procesného toku • (prog1 1 2 3 4) • (prog2 1 2 3 4) • (progn 1 2 3 4) • (let () 1 2 3 4)

  2. 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))

  3. 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))

  4. 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))

  5. 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)

  6. 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))

  7. 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))))

  8. 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))

  9. Riadenie procesného toku • (typecase '() (list "list") (number "number")) • (typecase '#() (list "list") (number "number")) • (ctypecase '#() (list "list") (number "number")) • (etypecase '#() (list "list") (number "number"))

  10. Riadenie procesného toku • (macroexpand-1 '(typecase nil (list 0 1))) (LET ((#:G30916 NIL)) (COND ((TYPEP #:G30916 'LIST) 0 1)))

  11. 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)))

  12. 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)))))

  13. 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)))

  14. 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))

  15. 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)))

  16. Riadenie procesného toku • (macroexpand-1 '(dotimes (x 5) (= x 0))) (DO ((X 0 (1+ X))) ((>= X 5) NIL) (= X 0))

More Related