;;; Exercice 1 ;; 1. (defun expand (l v) (mapcar (lambda (i) (make-list i :initial-element v)) l)) ;; 2. (defun multi (l v) (mapcan (lambda (i) (make-list v :initial-element i)) l)) ;;; Exercice 2 (defun mapparray (funs tab) (map 'vector #'funcall funs tab)) ;;; Exercice 3 ;; 1- 0 ;; 2- NIL ;; 3- 1 ;; 4- *STATE2* ;; 5- ;; 6- 2 ;; 7- T ;; 8- 1 ;; 9- ( ) ;;; Exercice 4 ;; 1. (defmacro creer-commande (nom arg-type &body body) `(progn (defun ,nom (,(first arg-type)) ,@body) (setf (gethash ',nom *commandes*) (lambda () (,nom (progn (format t "~A : " ',(second arg-type)) (read))))))) ;; 2. (defun appel-commande (name) (funcall (gethash name *commandes*)))