It would be interesting and helpful to see some motivating examples — code that is shorter, clearer, less error-prone, whatever, using “dyadic J” than the original “standard J”.
Would also be helpful to describe the intended audience. For example, are the motivating examples shorter, clearer, less error-prone, whatever, for novices? Calculus students? Immigrants from APL? J veterans? -Dan > On Nov 24, 2015, at 3:02 PM, 'Pascal Jasmin' via Programming > <[email protected]> wrote: > > A simple project whose benefits are described shortly: > > replace (add shaddow names) most of the monadic built-in verbs with > ambivalent definitions that may add extra utility. > > count =: # : #@] > > all monads have an obviously intuitive dyad alternative of v@], but some > monads can be given additional utility in a way that is still providing the > fundamental function. For instance > > iota =: i. : (+ i.) > > > 1 iota 3 > 1 2 3 > > roll =: ? : ?@# > > 5 roll 6 > 1 1 5 4 2 > > > benefits: > > providing extra utility to verbs is nice, but not the main reason. > > It would make J more approachable if every verb is a dyad whose monadic > interpretation can be understood as an ommitted default parameter. > > Its easier to read tacit code, for instance if iota and i. look different, > and the verbose version is verbose for the specific reason that it is a > monad. Tacit forks would look more like (word symbol word) if they are > intended as monadic forks, but may have dyadic tweaks. examples: > > > (3 * iota) 3 > 0 3 6 > 1 (3 * iota) 3 > 3 6 9 > > > The above tweak is a practical dyadic variation of essentially the same fork, > whereas with i. in the fork, the dyad use is likely a misapprehension of the > function. > > this may be cool too, > > > 1 (iota"0 iota) 4 > 0 0 0 > 1 0 0 > 1 2 0 > 1 2 3 > > The main benefit stated more succinctly is that real dyads would look > different than real monads, but overall fewer errors would occur as a result > of valence errors, and it also shortens some code. > > details: > > % - ^ ^. #. #: ] [ 0: ": j. p: r. p.. are examples of monads that would not > get a shaddow name, because their dyad is already a "default x" > implementation. > > * %. [: ". I. { ;: may have useful dyad tweaks I can't think of > > > Some verbs would have weird names > > real_imag =: +. : ({ +.) > length_ang =: *. : ({ *.) > > these may be bad ideas, but are interesting: > > double =: +: : (+:@]^:[) NB. double x times. -:*: > > curtail =: }: : (-@[ }. ]) NB. but }:@] would be more useful > > do =: ". : (".@(, ' ' , ])) > > Another approach is to avoid providing any improvements to the dyadic version > of monadic functions and instead make them all have dyad version of v@] > > Assuming that improvements are useful, can you think of any alternate > implementations for ambivalent: > > * %. [: ". I. { ;: > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
