J isn't a lazy language, so the programmer is required to be lazy instead. In other words, it looks like you are interested in some of the following:
M. http://www.jsoftware.com/help/dictionary/dmcapdot.htm ^: http://www.jsoftware.com/help/dictionary/d202n.htm if. http://www.jsoftware.com/help/dictionary/ctrl.htm I hope this helps, -- Raul On Mon, Jan 2, 2017 at 9:28 AM, David Koppenhoefer <[email protected]> wrote: > Ask, and you shall be covered in gifts :-) > > But I have a follow-up question. The function that actually should be > applied is rather expensive (it is the distance function of the > labyrinth of AoC 24), so it should only be executed on the selected > values. This seems not to be the case in > > 0 0 1 0 0 1 (* >:) i.6 > > where multiplication with zero happens after >: is computed (or so I > read it). Am I right here, is evaluation always strict? Or is there a > situation where evaluation of an argument is skipped because the end > result does not depend on it? > > David > > > Louis de Forcrand <[email protected]> writes: > >> Or >> >:@#`(I.@[)`]} >> >> Louis >> >>> On 02 Jan 2017, at 02:16, 'Pascal Jasmin' via Programming >>> <[email protected]> wrote: >>> >>> and, >>> >>> 0 0 1 0 0 1 >:@]^:["0 i.6 NB. passes original unchanged >>> >>> or as requested, >>> >>> 0 0 1 0 0 1 [`(>:@])@.["0 i.6 >>> >>> >>> >>> ----- Original Message ----- >>> From: 'Pascal Jasmin' via Programming <[email protected]> >>> To: "[email protected]" <[email protected]> >>> Sent: Sunday, January 1, 2017 8:10 PM >>> Subject: Re: [Jprogramming] dyadic valence of v in u&.v ? >>> >>> not what was asked but there is also >>> >>> 0 0 1 0 0 1 (* >:) i.6 >>> >>> >>> >>> >>> ----- Original Message ----- >>> From: Henry Rich <[email protected]> >>> To: [email protected] >>> Sent: Sunday, January 1, 2017 4:51 PM >>> Subject: Re: [Jprogramming] dyadic valence of v in u&.v ? >>> >>> You can't save it using &. . But nothing stops you from writing your >>> own conjunction. >>> >>> semidual =: 2 : 0 >>> : >>> u&.(x&v) y >>> ) >>> >>> Henry Rich >>> >>>> On 1/1/2017 3:40 PM, David Koppenhoefer wrote: >>>> Reading the wonderful NuVoc I found the gem that dyadic # has an inverse >>>> - it can therefore be used in &. like >>>> >>>>> : &. (0 0 1 0 0 1&#) i.6 >>>> 0 0 3 0 0 6 >>>> >>>> , executing a function only on selected items of an array while keeping >>>> the shape. >>>> >>>> The bit array is a noun, but I want to compute it on the fly (from the >>>> right argument). If the v in u&.v had dyadic valence, something like >>>> >>>> 0 0 1 0 0 1 >:@] &. # i.6 >>>> >>>> would be possible and the left argument could be replaced by a >>>> computation. Here I'm stuck. From what I understood so far this seems to >>>> be impossible - the v in the &-conjunctions is always monadic. Is >>>> there a way to save the idea? >>>> >>>> >>>> P.S.: needed in AoC day 24... >>>> ---------------------------------------------------------------------- >>>> 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 >>> ---------------------------------------------------------------------- >>> 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 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
