Re: Assuring dealing with PersistentVector for associative accesses

2014-05-08 Thread Joseph Rollins
Thanks, I haven't used pre and post conditions before but this seems like a good place to start. On Thursday, May 8, 2014 8:17:53 PM UTC-4, James Reeves wrote: > > If you're representing a matrix with vectors, then any public function > that operates on a matrix should return vectors. > > You ma

Re: Assuring dealing with PersistentVector for associative accesses

2014-05-08 Thread James Reeves
If you're representing a matrix with vectors, then any public function that operates on a matrix should return vectors. You may want to consider a function like: (defn matrix? [m] (and (vector? m) (every? vector m) (apply = (count m) (map count m))) Then add it as a pre and post

Re: Assuring dealing with PersistentVector for associative accesses

2014-05-08 Thread Joseph Rollins
This works for all cases were I transform the matrix using map, but I also transform it using reverse and assoc. On Thursday, May 8, 2014 8:02:03 PM UTC-4, Jason Ozias wrote: > > Take a look at mapv. If you aren't dealing with lazy sequence, it'll map > the function across and convert the outpu

Re: Assuring dealing with PersistentVector for associative accesses

2014-05-08 Thread Jason Ozias
Take a look at mapv. If you aren't dealing with lazy sequence, it'll map the function across and convert the output to a vector. On Thursday, May 8, 2014 7:28:47 PM UTC-4, Joseph Rollins wrote: > > I am confused about the best way to assure that I am dealing with a vector > when dealing with co