uncomplicate

2017-04-07T17:56:58.499907Z

@mroerni fmap! also accepts a (primitive) function whose first argument is a long -> that'll be the index of an element of a vector (column or row). Unfortunately, there is no way to provide both i and j... If you absolutely need both i and j, use (entry i j) in a loop...

2017-04-07T17:58:15.519918Z

@mroerni another option is to call fmap over all cols or rows.

2017-04-07T17:59:09.533957Z

@mroerni and the third option is to see whether you need those indexes at all, or there is some linear algebra function that can do what you need.

2017-04-07T18:06:27.648790Z

@mroerni just checked this. the previous is how fold works. fmap doesn't give the function access to the indexes. You'll have to loop yourself and use (entry! i j val).

2017-04-07T18:59:23.428642Z

@mroerni I think I have solution to what you want to do. 0.10.0-SNAPSHOT will have additional alter method variant that will alter all elements using a function, and feed indexes to this function if applicable. Watch the github repo and it will be there in a couple of days, since it is not difficult to implement.