Forgot to mention that i'm still calculating the minimum distance
between the vectors, but my output isn't actually the minimum value.
The output is the minimum value in terms of the vectors, if that makes
sense.


On Dec 2, 3:22 pm, Don <josereyno...@gmail.com> wrote:
> Thank you Stefan and Kevin.  Awesome solutions that answer my
> question.  However I actually made a mistake in posing my question.
> Let me attempt to ask my question again.
>
>  I have 5 vectors as such:
>  a [2 4 6 7]
>  b [1 3 9 2]
>  c [2 4 5 6]
>  d [6 1 3 8]
>  e [4 8 2 1]
>
> and the output i want is this
>
> a1 [0 0 0 0]
> b1 [1 0 0 0]
> c1 [0 0 0 0]
> d1 [0 1 0 0]
> e1 [0 0 1 1]
>
> Now I'm not sure if it can  be done in one swoop, or should be done in
> a loop.  I was thinking a loop, but I'm having trouble thinking about
> it.
>
> I initially thought of creating a function that takes in 5 vectors and
> returns a single vector.  So the first time its called it  would
> return a1 [0 0 0 0] then call it again and return b1 [1 0 0 0] etc...
> I know it will repeat calculations however I couldn't come up with
> anything else.
>
> Thank you.
>
> On Dec 2, 2:55 pm, Kevin Downey <redc...@gmail.com> wrote:
>
>
>
> > user=> (vec (map min [2 4 6 7] [1 3 9 2] [2 4 5 6] [6 1 3 8] [4 8 2 1]))
> > [1 1 2 1]
> > user=>
>
> > On Wed, Dec 2, 2009 at 2:53 PM, Stefan Kamphausen
>
> > <ska2...@googlemail.com> wrote:
> > > Hi,
>
> > > On Dec 2, 11:43 pm, Don <josereyno...@gmail.com> wrote:
> > >> I am having difficulty approaching this problem.  I'm not sure if it
> > >> can be done in one swoop, or requires a few steps.
>
> > >> I have 5 vectors as such:
>
> > >> a [2 4 6 7]
> > >> b [1 3 9 2]
> > >> c [2 4 5 6]
> > >> d [6 1 3 8]
> > >> e [4 8 2 1]
> > >> And I want to take the minimum value at a given index between the
> > >> vectors.  Therefore, minimum value at index 0 would yield the value 1
> > >> from vector b.
>
> > > a quick shot would be
>
> > > (reduce min (map #(get % 0) (list a b c d e)))
>
> > > It would be nicer to have a vector of vectors or a list of vectors at
> > > the beginning, probably.
>
> > > Cheers,
> > > Stefan
>
> > > --
> > > 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
>
> > --
> > And what is good, Phaedrus,
> > And what is not good—
> > Need we ask anyone to tell us these things?

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