Hi! I had a question while reading Functional Programming in Scala book. The following code is Exercise 2:
// Exercise 2: Implement a polymorphic function to check whether // an `Array[A]` is sorted def isSorted[A](as: Array[A], gt: (A,A) => Boolean): Boolean = { @annotation.tailrec def go(n: Int): Boolean = if (n >= as.length-1) true else if (gt(as(n), as(n+1))) false else go(n+1) go(0) } In the above code, Generic typ parameter(A) is displayed. How should I express it in clojure spec? (defn sorted-coll? [as ordered-fn?] (loop [coll (seq as)] (cond (= 1 (count coll)) true (not (ordered-fn? (first coll) (second coll))) false :else (recur (rest coll))))) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.