By the way you can also declare this tacitly using a similar technique alpha1t=: ([:) : ( ] /: [: <./ i."1 _ ) 5!:2 <'alpha1t' ┌──┬─┬─────────────────────────────┐ │[:│:│┌─┬──┬──────────────────────┐│ │ │ ││]│/:│┌──┬──────┬──────────┐││ │ │ ││ │ ││[:│┌──┬─┐│┌──┬─┬───┐│││ │ │ ││ │ ││ ││<.│/│││i.│"│1 _││││ │ │ ││ │ ││ │└──┴─┘│└──┴─┴───┘│││ │ │ ││ │ │└──┴──────┴──────────┘││ │ │ │└─┴──┴──────────────────────┘│ └──┴─┴─────────────────────────────┘ aA alpha1t fruits Fig Kiwi Peach Pear
Cheers, bob > On Aug 7, 2018, at 2:54 PM, 'robert therriault' via Programming > <[email protected]> wrote: > > Hi Linda, > > I am using this thread to reply to your question in order to get off the > thread that Henry and Bill are using for their debugging conversation. > > You asked: > > Thanks. However, I was trying to use the example to show the differences > between an explicit definition using 3 : and a tacit version using 13 : . > > Is there a way to show my explicit definition as is usually the way 3 : > works? > > Linda > > I think that if you are looking for a way to define a dyadic verb using 3 : > in one line - the way to do it is to box the multiline verb so that each box > represents a line. The first line of the monadic case is [: which means that > it is not going to work monadically at all. Sp when the parser moves along > the line and gets to > > alpha1 fruits > > it will know that this is not a monadic verb and moves on to > > aA alpha1 fruits > > which it can process. Without the [: it tries to process the monadic form and > gives you your domain error. > > The following creates a one line explicit verb that works. > > ('[:';':';'y /: <./x i."1 _ y') NB. boxed script > ┌──┬─┬──────────────────┐ > │[:│:│y /: <./x i."1 _ y│ > └──┴─┴──────────────────┘ > alpha1=: 3 : ('[:';':';'y /: <./x i."1 _ y') > aA alpha1 fruits > Fig > Kiwi > Peach > Pear > > Cheers, bob > >> On Aug 7, 2018, at 7:47 AM, Brian Schott <[email protected]> wrote: >> >> Linda, >> >> Try alpha2 instead of alpha1 to circumvent the domain error because 4 >> signals a dyadic verb. >> >> alpha1=: 3 :'y /: <./x i."1 _ y' >> alpha2=: 4 :'y /: <./x i."1 _ y' >> >> It's a little puzzling what you are trying to do because the following >> gives a similar result. >> >> /:~fruits >> Fig >> Kiwi >> Peach >> Pear >> >> (If this question has already been answered, I am sorry to clutter the mail >> list.) >> -- >> (B=) <-----my sig >> Brian Schott >> ---------------------------------------------------------------------- >> 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
