+;(trace true)
+
+(define (qsort L)
+ (cond
+ ((null? L) '())
+ ((append
+ ;the pivot is the first element of the list
+ (qsort (list< (first L) (rest L)))
+ (list (first L))
+ (qsort (list>= (first L) (rest L)))))))
+(println "qsort")
+(println (qsort C))
+
+;(trace nil)
+
+;we suppose both lists are flat
+(setq L1 '(A ? ? B C D ?))
+(setq L2 '(? A B ? C ? ? D))
+
+;(println "replace")
+;(println L1)
+;(println L2)
+;the replace function modify the passed argument
+;(println (replace 'B L1))
+;(println (replace '? L1))
+;(println (replace '? L2))
+;(println L1)
+;(println L2)
+
+(define (filtre L1 L2 C)
+ ;the replace function modify the passed argument
+ ;FIXME: use the function argument C
+ (replace '? L1)
+ (replace '? L2)
+ (cond
+ ((and (null? L1) (null? L2)) true)
+ ((and (not (null? L1)) (null? L2)) nil)
+ ((and (null? L1) (not (null? L2))) nil)
+ ((and (inclu L1 L2) (inclu L2 L1) true))))
+(println "filtre")
+(println (filtre L1 L2 ?))
+(println (filtre L M ?))
+
+;algorithm written on the board
+(define (filtrerec L1 L2 C)
+ ;FIXME: use the function argument C
+ (cond
+ ((null? L1)
+ (cond
+ ((null? L2) true)
+ ((= '? (first L2)) (filtrerec L1 (rest L2)))
+ (nil)))
+ ((null? L2) (filtrerec L2 L1))
+ ((= '? (first L1)) (filtrerec (rest L1) L2))
+ ((= '? (first L2)) (filtrerec L1 (rest L2)))
+ ((= (first L1) (first L2)) (filtrerec (rest L1) (rest L2)) )
+ (nil)))
+(println "filtrerec")
+(println (filtrerec L1 L2 ?))
+(println (filtrerec L M ?))
+