Order two numerical lists: Difference between revisions

Content added Content deleted
Line 140: Line 140:


<lang clojure>
<lang clojure>
(defn lex? [[x & xs] [y & ys]]
(defn lex? [a b]
(cond
(reduce =
(= x y) (lex xs ys)
(map (fn [[a b]] (<= (compare a b) 0) )
(> (compare x y) 0) false
(map vector a b))))
:else true))
</lang>
</lang>