On Fri, May 18, 2012 at 11:03 AM, octopusgrabbus
<octopusgrab...@gmail.com> wrote:
> In our production development environment, we perform a lot of data
> transfers between diverse systems, and most of those transfers involve
> comma-delimited (.csv) data. So my first small Clojure applications have
> revolved around the clojure-csv library.
>
> While learning Clojure I have seen the comment that using nth "stinks",
> because it creates dependencies. Wanting to do things in a Clojure way, I
> have a question.
>
> If I need to extract a number of columns of a spreadsheet to minimize the
> dataset and this happens as the application is reading in and initializing
> its data, what should I use to extract those columns other than nth? And, if
> I use a series first and rest, isn't that also positional?
>
> I've thought of ways to re-position the data initially, so comparison
> columns between two different spreadsheets that have one unique key column
> in common would be accessible with first, for example. However, I would
> still need to get at that data by column in order to reposition it, hence
> the need for nth.

I think the point of the parts of the discussion that I've been privy
to so far is mostly that `nth` is something that a novice clojurist
might reach for because they don't have a grasp of the sequence
abstraction as well as stream operations and laziness, in the same way
that many people immediately reach for loop/recur when some form of
list comprehension would've solved the problem better.

Once you have your mind around these other concepts (or perhaps even
before, this is a practical language after all) there's absolutely
nothing wrong with `nth`. It just probably shouldn't be everywhere in
your code unless your domain (like, say, a domain heavy in csv data,
perhaps?) supports the need for it.

It does tie you to ordering so it may be worth the effort to pour your
non-tagged csv data into maps so that your implementation code can be
happily ignorant if the order of the fields ever changes. You may know
things about your domain that would be good counterarguments to that.

Anyway, good to know you're still soldiering on. ;)

--

Timmy V.

http://twonegatives.com/
http://five.sentenc.es/ -- Spend less time on mail.

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