I'm having trouble with the suggested fix (shortened function name for
testing).

Here is some test data:
(def vv1 [[49 48 47 46 nil 1 2 3 4][5 6 7 8 9 10 11 12 13]])

(defn f1
  [all-csv-rows]
  (let [clean-rows (vec (filter #(and (pos? (count %)) (not (cstr/
blank? (nth % 5 nil)))) all-csv-rows) ) ]
      clean-rows))

This function is returning

 (f1 vv1)
java.lang.RuntimeException: java.lang.ClassCastException:
java.lang.Integer cannot be cast to java.lang.CharSequence
(NO_SOURCE_FILE:0)
addr-verify=>

cmn


On Aug 1, 4:51 pm, octopusgrabbus <octopusgrab...@gmail.com> wrote:
> I'm going to give filter a shot.
>
> On Aug 1, 4:27 pm, Mark Rathwell <mark.rathw...@gmail.com> wrote:
>
>
>
>
>
>
>
> > A few more things:
>
> >  -  I don't know if you want to be passing the start val to reduce in this
> > case ([]), it's not doing anything here
>
> >  - you have the arguments to > backwards.  (> 0 2) in prefix is (0 > 2) in
> > infix notation, so this will always return false in your code since the
> > vector count will never be less than zero
>
> >  - Any reason you can't just use filter ?
>
> > On Mon, Aug 1, 2011 at 4:11 PM, Meikel Brandmeyer <m...@kotka.de> wrote:
> > > Hi,
>
> > > Am 01.08.2011 um 21:55 schrieb octopusgrabbus:
>
> > > > I get back a vector of vectors from clojure-csv/parse-csv. I want to
> > > > remove vectors from that sequence based on the out come of certain
> > > > tests on individual vector elements.
>
> > > You can't easily slice out elements from the middle of a vector. You will
> > > have to reconstruct the vector. Simplest is to go the sequence route.
>
> > > (defn filter-parsed-csv-rows
> > >   [all-csv-rows]
> > >  (vec (filter #(and (pos? (count %)) (not (cstr/blank? (nth % 5 nil))))
> > > all-csv-rows)))
>
> > > > Below, get-parsed-csv-file is called first and returns clean-csv-rows.
> > > > filter-parsed-csv-rows is called with clean-csv=rows, but is not
> > > > returning anything. I'm trying to figure out why.
>
> > > It's because you return nil when your predicate isn't fulfilled. You have
> > > to return checked-row in the else branch of the if.
>
> > > Hope that helps.
>
> > > Sincerely
> > > Meikel
>
> > > --
> > > 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 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