Permalink
Browse files

Simplify degree function taking into account that terms are stored in…

… an ordered map
  • Loading branch information...
1 parent 9463fad commit 69dab5b3849ff9938d1638b4ab3c0bc41fde757e @ray1729 committed Jun 10, 2010
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/ray1729/clojure/polynomials.clj
@@ -47,7 +47,7 @@
(def variable (accessor polynomial-struct :variable))
(def terms (accessor polynomial-struct :terms))
-(defn degree [p] (reduce max (map key (filter #(not (zero? (val %))) (terms p)))))
+(defn degree [p] (key (last (terms p))))
(defmethod gc/zero? ::polynomial
[p]

0 comments on commit 69dab5b

Please sign in to comment.