nocturnalmk

секој втор атом стави го во посебни загради

May 13th, 2013
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 0.30 KB | None | 0 0
  1. (defun sekojVtor (lista)
  2.     (sekojVtorPom lista 0)
  3. )
  4.  
  5. (defun sekojVtorPom (lista zag)
  6.     (cond
  7.         ((null lista) nil)
  8.         ((eq zag 0) (cons (car lista) (sekojVtorPom (cdr lista) 1)))
  9.         ((eq zag 1) (append (list (list (car lista))) (sekojVtorPom (cdr lista) 0)))
  10.     )
  11.  
  12. )
  13.  
  14. (print (sekojVtor '(1 2 3 4 5 6)))
Advertisement
Add Comment
Please, Sign In to add comment