Hi folks,

    I had some fortune with the sorted-by function:

1:11 user=> (sort-by (fn [e] (second e)) [[1 99] [3 4] [5 6] [7 8]])
([3 4] [5 6] [7 8] [1 99])

    so I thought I'd have a go with sorted-map-by also:

1:13 user=> (doc sorted-map-by)
-------------------------
clojure.core/sorted-map-by
([comparator & keyvals])
  keyval => key val
  Returns a new sorted map with supplied mappings, using the supplied
comparator.

1:14 user=> (sorted-map-by (fn [c] c) 1 2)
{1 2}
1:15 user=> (sorted-map-by (fn [c] c) 1 2 3)
java.lang.IllegalArgumentException: No value supplied for key: 3
(repl-1:15)
1:16 user=> (sorted-map-by (fn [c] c) 1 2 3 4)
java.lang.RuntimeException: java.lang.IllegalArgumentException: Wrong
number of args passed to: user$eval--85$fn (repl-1:16)

    I expected line 1:15 to fail because I didn't have matching
quantities of keys and values, but I don't know what I've done wrong
in 1:16. I searched the google group discussions for "sorted map by",
but I didn't understand what I found. Would a compassionate soul guide
me to where I went wrong?

Kev
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to