Fork me on GitHub

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


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


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


@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).


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