205 let associatedInteractionRed [n] 'a 'b (ne:b) (add: b-> b -> b)(potential: a -> a -> b) (co
ordinates:[n]a) associations =
206 let interaction [k] (acc: *acc ([k]b)) (i, j) : (*acc ([k]b)) =
207 let cI = coordinates[i]
208 let cJ = coordinates[j]
209 let v = potential cI cJ
210 in write (write acc i v) j v
211 let fts = reduce_by_index_stream
212 (replicate n ne)
213 add
214 ne
215 interaction
216 |> unzip
217 in fts
accumulators
, we haven't really tested it at all yet!