Differences
This shows you the differences between two versions of the page.
jui:cviko1 [2011/08/16 22:33] |
jui:cviko1 [2011/08/16 22:33] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== JUI - 1. cviceni ====== | ||
+ | <code lisp> | ||
+ | (defun soucet (x y) | ||
+ | (cond ((eq x 0) y) | ||
+ | ( T (+ 1 (soucet (- x 1) y) ) ) | ||
+ | ) | ||
+ | ) | ||
+ | |||
+ | |||
+ | (defun rozdil (x y) | ||
+ | (cond ( (eq y 0) x) | ||
+ | ( T (- (rozdil x (- y 1)) 1)) | ||
+ | ) | ||
+ | ) | ||
+ | |||
+ | (defun mensirovno (x y) | ||
+ | (cond ( (eq x 0) t) | ||
+ | ( (eq y 0) NIL) | ||
+ | (t (mensirovno (- x 1) (- y 1))) | ||
+ | ) | ||
+ | ) | ||
+ | |||
+ | (defun soucin (x y) | ||
+ | ( cond ( (eq x 1) y) | ||
+ | ( t (soucet (soucin (- x 1) y) y)) ) | ||
+ | ) | ||
+ | |||
+ | (defun mocnina (x y) | ||
+ | (cond ((eq y 0) 1) | ||
+ | (t (soucin x (mocnina x (- y 1))) ) | ||
+ | ) | ||
+ | ) | ||
+ | |||
+ | </code> | ||
+ | |||
+ | |||