Interesing articles. Here's my Grade 3 solution.
]A=: 1 2 3 ;"0"0 _ [ 4 5 6 7 --T-┐ │1│4│ +-+-+ │1│5│ +-+-+ │1│6│ +-+-+ │1│7│ L-+-- --T-┐ │2│4│ +-+-+ │2│5│ +-+-+ │2│6│ +-+-+ │2│7│ L-+-- --T-┐ │3│4│ +-+-+ │3│5│ +-+-+ │3│6│ +-+-+ │3│7│ L-+-- ]B=: (<"0)1 2 3 ,"0/ 4 5 6 7 --T-┐ │1│4│ +-+-+ │1│5│ +-+-+ │1│6│ +-+-+ │1│7│ L-+-- --T-┐ │2│4│ +-+-+ │2│5│ +-+-+ │2│6│ +-+-+ │2│7│ L-+-- --T-┐ │3│4│ +-+-+ │3│5│ +-+-+ │3│6│ +-+-+ │3│7│ L-+-- A-:B 1 Linda -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of R.E. Boss Sent: Tuesday, February 3, 2015 3:07 PM To: [email protected] Subject: Re: [Jprogramming] Fold/reduce with initial value? It was said long before <http://www.jsoftware.com/pipermail/general/2006-September/027793.html> http://www.jsoftware.com/pipermail/general/2006-September/027793.html " What has been will be again, what has been done will be done again; there is nothing new under the sun", Ecclesiastes 1:9 R.E. Boss > -----Original Message----- > From: <mailto:[email protected]> [email protected] [mailto:programming- > <mailto:[email protected]> [email protected]] On Behalf Of Marshall Lochbaum > Sent: dinsdag 3 februari 2015 20:39 > To: <mailto:[email protected]> [email protected] > Subject: Re: [Jprogramming] Fold/reduce with initial value? > > Since nobody's said it directly yet, I will: it is impossible to do > this efficiently in pure J and I consider it one of the language's > biggest omissions. > > In an ideal J, dyadic u/ would perform this task (and its current use, > table, would have a different name). The lack of a built-in adverb of > any sort to perform the task can have substantial performance > implications. > > Marshall > > On Tue, Feb 03, 2015 at 06:15:37PM +0200, Moon S wrote: > > I have a list (l), some object (o) and a verb (v) modifying the object: > > > > l = l_0 l_1 ... l_n > > o_new = o_old v l_i > > > > The list items and the object have different types. I want to apply > > all the > > list items to the object: > > > > o_new = (...((o_old v l_0) v l_1) ... v l_n) NB. the order of items > > doesn't matter > > > > Currently I do it like this: > > > > o =: o_old > > 3 : 'o =: y v o' "0 l > > > > I suspect, there must be some built-in feature for that, like / or > > ^:, so > > that I could write e.g. > > o_new =: o_old v REDUCE l, but I couldn't find a suitable > > verb/adverb/conjunction. > > > > Any help? > > > > Thank you. > > > > Georgiy Pruss. > > -------------------------------------------------------------------- > > -- > > For information about J forums see > <http://www.jsoftware.com/forums.htm> http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see <http://www.jsoftware.com/forums.htm> http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see <http://www.jsoftware.com/forums.htm> http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
