;<@(*{.)\.>:i.5 1 2 3 4 5 4 6 8 10 9 12 15 16 20 25
~.,*/~>:i.5 1 2 3 4 5 6 8 10 9 12 15 16 20 25 R.E. Boss > -----Oorspronkelijk bericht----- > Van: programming-boun...@jsoftware.com > [mailto:programming-boun...@jsoftware.com] Namens Raul Miller > Verzonden: maandag 25 juni 2012 18:51 > Aan: Programming forum > Onderwerp: Re: [Jprogramming] Multiplying with folds > > Why do you want this? > > If it's efficiency, note that the size of the dense array */~N is > typically less than the size of a linked list which only represents > the products of unique combinations of pairs (if we assume that linked > list pointer size is approximately the same size as a number), and > also note that typical cpu cache implementation heavily favors regular > operations. > > If it's because you need unique values, you might consider using: > > ~.,*/N > > If it's for some other purpose, the topic might have inherent interest... > > Thanks, > > -- > Raul > > On Mon, Jun 25, 2012 at 12:37 PM, David Vaughan <purpleblue...@gmail.com> > wrote: > > I'm looking for a verb to achieve the same thing as just the unique items > > of */~ N, i.e. n0*(n0 ... nk) n1*(n1 ... nk) n2*(n2 ... nk) ... nk*nk. > > > > I can easily create the result, but I want to be able to calculate it more > > efficiently, without having to do the multiplications that will ultimately > > be redundant (which would be ~.,*/~ N). > > > > I'm not particularly good with folds and similar concepts, so I expect the > > solution is relatively simple. Can anyone help? > > > > Many thanks. > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm