ciekawe_funkcje.txt

(0 KB) Pobierz
(defun co-robi (arg) 
  (do ((i (- (length arg) 1) (- i 1)))
      ((= i 0))
    (do ((j 0 (+ j 1)))
        ((= j i))
      (when (< (nth i arg) (nth j arg))
        (let ((tmp (nth i arg))) (setf (nth i arg) (nth j arg) (nth j arg) tmp)))))       
  arg)


(defun moja (l) 
	   ( do ((x  l (cdr x))
       (y nil))
      ((null x) (reverse y))
    (push (+ (car x) 2) y))
	   )


;Lambda

> #'(lambda (x) (+ x 3))
(LAMBDA (X) (+ X 3))
> (funcall * 5)



> (do ((x '(1 2 3 4 5) (cdr x))
       (y nil))
      ((null x) (reverse y))
    (push (+ (car x) 2) y))
(3 4 5 6 7)

> (mapcar #'(lambda (x) (+ x 2)) '(1 2 3 4 5))
(3 4 5 6 7)
Zgłoś jeśli naruszono regulamin