Order two numerical lists: Difference between revisions

Content added Content deleted
Line 140: Line 140:


<lang clojure>
<lang clojure>
(defn lex? [a b]
(defn lex? [[x & xs] [y & ys]]
(cond
(let [sa (count a) sb (count b)]
(if (= sa sb)
(= x y) (lex xs ys)
(< (compare a b) 0)
(> (compare x y) 0) false
(> sb sa))))
:else true))
</lang>
</lang>