About apply type apply and you will see its def. type edit 'apply' and you will see its def and where it comes from (stdlib script auto loaded by the standard profile) type edit'edit' same (jadefull script) The existence of verb edit was revealed by Don Guinn and is probably not documented.
About the problem itself This problem has been raised many times since the arrival of J. The neatest solution IMO has been given by Henry Rich in message http://www.jsoftware.com/pipermail/general/2005-October/025448.html While reading the thread, note that x. y. m. n. u. v. are now replaced by x y m ... The main idea rests on applying a gerund with an infix of length 1. 1 +:`*:`-: \ 3 4 5 NB. infixes of length 1 6 16 2.5 ($;]) 1 +:`*:`-: \ i. 4 3 NB. applies to higher rank too; gerund items applied cyclically +-----+---------+ |4 1 3| 0 2 4| | | | | | 9 16 25| | | | | | 3 3.5 4| | | | | |18 20 22| +-----+---------+ ,/ 1 +:`*:`-: \ 3 4 5 NB. One may prefer to ravel over the items of the result 6 16 2.5 Henry thus gives the explicit adverb "In plain J, appl =: 1 : '(,/)@(1&(u\))' NB. I changed u. into u " Building it tacitly (also given by Henry) involves sticking the constant 1 (1&) to adverb \ . Note that 1& is an adverb. Should you write this? +:`*:`-: (1&)\ 3 4 5 |domain error | +:`*:`-:(1&)\3 4 5 NO!, 1& as an adverb goes to the RIGHT of its argument (as in +/) +:`*:`-: \(1&) 3 4 5 6 16 2.5 The train \(1&) is an adverb (Dic F.Trains) and the current sentence has the form gerund adv noun. To add ravel over the items after the infix execution, one may be tempted to add ,/@ (an adverb) in front of the new adverb: +:`*:`-: ((,/@) \(1&)) 3 4 5 |domain error | +:`*:`-:((,/@)\(1&))3 4 5 NO! By the same reasoning as above, this modifying adverb should be on the right of its arg +:`*:`-: ( \(1&)(,/@)) 3 4 5 6 16 2.5 appl =. \ (1&) (,/@) +:`*:`-: appl 3 4 5 6 16 2.5 ~ Gilles ---------- Original Message ----------- From: "Steven Taylor" <[email protected]> To: "'Programming forum'" <[email protected]> Sent: Sat, 31 Jan 2009 10:19:46 -0000 Subject: Re: [Jprogramming] gerrunds > I found these links which look quite useful: > > * HYPERLINK > "http://www.jsoftware.com/jwiki/DanBron/Snippets/DOOG"http://www.jsoftware.c > om/jwiki/DanBron/Snippets/DOOG > > * HYPERLINK > "http://www.jsoftware.com/svn/DanBron/trunk/general/doog.ijs"http://www.jsof > tware.com/svn/DanBron/trunk/general/doog.ijs > > thanks for the apply & gmon ideas. Where is ‘apply’ documented? > Also, with gerunds do we start to sacrifice performance for > expressiveness? Is there a body of thought that describes these > constructs? It might help to have a reference. Otherwise I’ll > struggle on. I’m thinking of it as cool things to do with a list of > function pointers at the moment… but since J has such rich > mathematical foundations, perhaps there’s some other work that would > be good to learn about. > > Steven ... ------- End of Original Message ------- ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
