;;; Exercice 2 ;; 1. (defun lex<= (l1 l2) (or (endp l1) (and l2 (or (< (car l1) (car l2)) (and (= (car l1) (car l2)) (lex<= (cdr l1) (cdr l2))))))) ;; 2. ;; RÉPONSE A (sort (copy-list *l*) #'lex<=) ;; RËPONSE B (NIL (1) (1 2) (1 2 3) (2 1) (2 3)) ;;; Exercice 3 ;; 1. (sort (remove-duplicates (mapcar (lambda (person) (year (birth-date person))) *persons*)) #'<) ;; 2. ;; RÉPONSE C 2010/12/25 ;; RÉPONSE D "Oscar":2010/12/25 ;; 3. ;; RÉPONSE E 2010/12/25 ;; RÉPONSE F "Oscar":2010/12/25 ;; RÉPONSE G ; Evaluation aborted ;; 4. (defun read-data-file (file) (with-open-file (stream file) (read-data-stream stream))) ;; 5. (defun write-data-stream (persons stream) (let ((*print-for-file* t)) (loop for person in persons do (print-object person stream) do (format stream "~%")))) ;; 6. (defun save-persons (file) (write-data-file *persons* file))