Here's another example of my suggestion:

 

These two expressions have the same result.

 

           eb=: 13 :'y $<'' '''

   ([:<eb)"1(>:i.2),"0/>:i.4

----T-----T-------T---------┐
│--┐│--T-┐│--T-T-┐│--T-T-T-┐│
││ │││ │ │││ │ │ │││ │ │ │ ││
│L--│L-+--│L-+-+--│L-+-+-+--│
+---+-----+-------+---------+
│--┐│--T-┐│--T-T-┐│--T-T-T-┐│
││ │││ │ │││ │ │ │││ │ │ │ ││
│+-+│+-+-+│+-+-+-+│+-+-+-+-+│
││ │││ │ │││ │ │ │││ │ │ │ ││
│L--│L-+--│L-+-+--│L-+-+-+--│
L---+-----+-------+----------

   ([:<eb)"1(>:i.2),"0/>:i.4

----T-----T-------T---------┐
│--┐│--T-┐│--T-T-┐│--T-T-T-┐│
││ │││ │ │││ │ │ │││ │ │ │ ││
│L--│L-+--│L-+-+--│L-+-+-+--│
+---+-----+-------+---------+
│--┐│--T-┐│--T-T-┐│--T-T-T-┐│
││ │││ │ │││ │ │ │││ │ │ │ ││
│+-+│+-+-+│+-+-+-+│+-+-+-+-+│
││ │││ │ │││ │ │ │││ │ │ │ ││
│L--│L-+--│L-+-+--│L-+-+-+--│ L---+-----+-------+----------

 

Define each one as  I  and  j

 

   

   i=: 13 :'(<@eb)"1(>:@i.x),"0/>:@i.y'

   j=: 13 :'([:<eb)"1(>:i.x),"0/>:i.y'

 

Both agree as monads and dyads.   

 

(i 2)-:j 2

1

   (2 i 4)-:2 j 4

1

 In the interpretation of J,  [:  is inserted when appropriate.

 

My question is: "why couldn't both have the same

Definition when trains are involved. It @ is superior, I would suggest the
definition of  i

 for both.   

  

    eb

(<' ') $~ ]

   

   i

[: <@eb"1 ([: >:@i. [) ,"0/ [: >:@i. ]

   

   j

[: ([: < eb)"1 ([: >: [: i. [) ,"0/ [: >: [: i. ]

 

Linda

   

   eb   

(<' ') $~ ]

   

 

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Kip Murray
Sent: Monday, February 9, 2015 11:00 AM
To: [email protected]
Subject: Re: [Jprogramming] Source of frustration

 

And this:

 

   hh =: 3 : '[: >: i. y'

   hh

3 : '[: >: i. y'

   hh 4

|domain error: hh

|       [:>:i.y

 

I think Brian's suggestion that you parenthesize the result of 13 : before
applying arguments is the best way of removing your frustration.  My point
about parenthsizing [: > i. before applying arguments is specific to verbs
defined by trains.

 

--Kip

 

 

On Monday, February 9, 2015, Linda Alvord < <mailto:[email protected]>
[email protected]> wrote:

 

> How about this:

> h=: 13 :'[:>:i.y'

>    h

> [: [: [: >: i.

> 

>    [: [: [: >: i. 4

> |domain error: scriptd

> |   [:[:    [:>:i.4

> 

> Linda

> 

> 

> -----Original Message-----

> From:  <mailto:[email protected]>
[email protected] <javascript:;> 

> [ <mailto:[email protected]%20%3cjavascript:;%3e>
mailto:[email protected] <javascript:;>] On 

> Behalf Of Brian Schott

> Sent: Monday, February 9, 2015 10:00 AM

> To: Programming forum

> Subject: Re: [Jprogramming] Source of frustration

> 

> Linda,

> 

> If you are willing to put parentheses around your example verbs -- 

> with the data outside the parens, you will not get the domain error.

> 

> On Mon, Feb 9, 2015 at 9:54 AM, Linda Alvord <[email protected] 

> <javascript:;>>

> wrote:

> 

> > Suppose:   ff=: 13 :'>:i.y'

> >    ff

> > >:@i.

> > Then:

> >   >:@i.4

> > 1 2 3 4

> > Which is what you want, more than a domain error.

> >

> > Linda

> >

> > --

> (B=)

> ----------------------------------------------------------------------

> 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

> 

 

 

--

Sent from Gmail Mobile

----------------------------------------------------------------------

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

Reply via email to