#(nth % 1) is the same as clojure.core/second. You can also use (.split data "\n") instead if you like; it's nice to have the function first.
On Oct 25, 9:04 am, Tim Webster <timothy.webs...@gmail.com> wrote: > I thought that the issue might be that the concrete data still was not > populated in my list-of-lists, unlike your literal, so I started with > a clean environment and re-ran my repl session line by line from the > jline history file. I could not reproduce the error. (Which troubles > me even more...the error had to come from somewhere.) > > For the record, here is how I build the table: > > (def data (slurp "data.txt")) > (def lines (. data split "\n")) > (def my-table (map #(. % split "\t") lines)) > > On Oct 25, 9:28 am, Ken Wesson <kwess...@gmail.com> wrote: > > > On Oct 24, 11:46 pm, Tim Webster <timothy.webs...@gmail.com> wrote: > > > > I have an issue that I think is related to laziness, but I am not sure > > > I understand where the problem lies. > > > > Let's say I have tabular data in a sequence of sequences. I get the > > > second column of the table like this: > > > > (map #(nth % 1) my-table) > > > > I can do some sequence things directly to the list returned by the > > > call to function, but not everything. For example, > > > > (distinct (map #(nth % 1) my-table)) > > > > works fine, but > > > > (frequencies (map #(nth % 1) my-table)) > > > > throws java.lang.RuntimeException: java.lang.IndexOutOfBoundsException > > > I can't reproduce this with Clojure 1.2: > > > user=> (frequencies (map #(nth % 1) [[1 2 3][4 5 6][1 2 3]])) > > {2 2, 5 1} > > -- 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