Linda, every time you try to use  x u&.v y ↔ vi (v x) u (v y) to make a 
substitution, you must remember to respect rank (I know that one sentence in 
the definition of &. doesn't say so explicitly, so you must remember for 
yourself). 

Open (>) is rank 0, i.e. operates on individual atoms,  so somewhere in your 
replacement you must do likewise. The most straightforward way to say this is 
just to say it:

   sh =: 13 : '< (>x) ,~ (>y)' NB. vi (v x) u (v y)
   h =: 13 : 'x sh"0/ y' NB. g with sh"0 substituted for ,~&.>

   (B h A) -: (B g A)
1
 
   sh
[: < ([: > [) ,~ [: > ]
   h f.
([: < ([: > [) ,~ [: > ])"0/

Here, it's the isolation of vi (v x) u (v y) and the explicit application of it 
at "0 (rank zero) that makes the substitution work. Try removing the "0 or 
embedding sh into h directly (in its x and y form, as opposed to its tacit 
from) and see what happens.

Finally I'll recommend, as I do every time we discuss this, that you step back, 
try to shelve any preconceptions, and with new eyes, sincerely compare 

([: < ([: > [) ,~ [: > ])"0/

with

,~ each/

and perhaps reconsider your position on eliminating conjunctions. If your goal 
is simplicity, to make J easier to learn for kids, I just can't see how anyone 
would look at those two expressions and say "whoa, the first one is simpler".

-Dan

PS: And not to pick nits, but the first sentence contains a conjunction as well 
(") and not only is it necessary, it's fundamental to the solution. So if we're 
going to accept ", why not also accept &. and stop worrying?



> On Apr 4, 2014, at 2:25 AM, "Linda Alvord" <lindaalv...@verizon.net> wrote:
> 
> Here’s the problem.  Hopefully this looks better and fully defines the
> problem.
> 
>   f=: 13 :'  (B=:;:''am pm''),~&.>/A=:<"1 ":":"0>:i.y'
>   f 12
> ┌────┬────┬────┬────┬────┬────┬────┬──
> ──┬────┬────┬────┬────┐
> │1 am│2 am│3 am│4 am│5 am│6 am│7 am│8 am│9 am│10am│11am│12am│
> ├────┼────┼────┼────┼────┼────┼────┼──
> ──┼────┼────┼────┼────┤
> │1 pm│2 pm│3 pm│4 pm│5 pm│6 pm│7 pm│8 pm│9 pm│10pm│11pm│12pm│
> └────┴────┴────┴────┴────┴────┴────┴──
> ──┴────┴────┴────┴────┘
>   A
> ┌──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┐
> │1 │2 │3 │4 │5 │6 │7 │8 │9 │10│11│12│
> └──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┘
>   B
> ┌──┬──┐
> │am│pm│
> └──┴──┘
>   g=: 13 :'x(,~&.>)/y'
>   B g A
> ┌────┬────┬────┬────┬────┬────┬────┬──
> ──┬────┬────┬────┬────┐
> │1 am│2 am│3 am│4 am│5 am│6 am│7 am│8 am│9 am│10am│11am│12am│
> ├────┼────┼────┼────┼────┼────┼────┼──
> ──┼────┼────┼────┼────┤
> │1 pm│2 pm│3 pm│4 pm│5 pm│6 pm│7 pm│8 pm│9 pm│10pm│11pm│12pm│
> └────┴────┴────┴────┴────┴────┴────┴──
> ──┴────┴────┴────┴────┘
>   g
> ,~&.>/
> 
> NB. x u&.v y ↔ vi (v x) u (v y)   Definition of Under
> 
> 
> I can’t seem to write  a simple definition   h=:       but use the second
> definition of under.
> 
> It should have the same result as  B g A  when you enter   B h A
> 
> Linda
> 
> 
> 
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to