There is an ongoing discussion about whether the function should accept an index as well. The argument for not passing in the index is that it seems silly for functions like plus, sin and max to get an index. You just gave the argument for passing the index.
My preferred solution to this is to have an IndexedFunction type. Functions.ABS is just a DoubleFunction. It is assumed that pretty much all indexed functions would be defined in-line. For the case where you are referring to another vector element by a corresponding index, there are versions of assign which take a vector and a binary function. This usually handles the case that you describe, but there are still corner cases especially where you want to do something to a vector based on corresponding rows (or columns) of a matrix. On Thu, Aug 18, 2011 at 10:47 AM, Gilles Sadowski < gil...@harfang.homelinux.org> wrote: > Not even saying that the code will become unreadable. One instance where > I'd perform "addToEntry", the "value" below is computed from a matrix entry > whose column index is "i". How do you retrieve that from the prototype > above? >