Here's your definition of g:

   g=: 13 :'4*& y'

Here's the atomic representation:

   5!:1<'g'
┌─────────────────────┐
│┌─┬─────────────────┐│
││:│┌─────┬─────────┐││
││ ││┌─┬─┐│┌─┬─────┐│││
││ │││0│3│││0│4*& y││││
││ ││└─┴─┘│└─┴─────┘│││
││ │└─────┴─────────┘││
│└─┴─────────────────┘│
└─────────────────────┘

So let's try extracting the part that corresponds to the ,: part of your
tree display:
   (0;1;1;1) {:: 5!:1<'g'
|length error

Oops...

   ('';1;1;1) {:: 5!:1<'g'
4*& y

There we go. So what shape is it?

   $('';1;1;1) {:: 5!:1<'g'
1 5

Hmm... so how might we reproduce that shape at the command line?

   $,:'4*& y'
1 5

Bingo!

In APL, there was a quadCR primitive which, given the name of a function
(verb) would come back with the character representation of the definition
of that verb. This character representation was an 2 dimensional array of
characters. (I also remember a quadVR primitive which came back with a
vector representation.)

I imagine that that quadCR concept influenced the design, here. Underlying
it is the idea of using fixed width fonts to simplify the task of
organizing text vertically.

And that's probably far enough on that tangent?

Thanks,

-- 
Raul

On Sun, Mar 9, 2014 at 11:26 AM, Linda Alvord <[email protected]>wrote:

> Thanks Raul and Kip,  Here is how I should have written the four verbs:
>
> NB.  m&v y is defined as m v y
> NB. u&n y  is defined as y u n
>
>    f=: 13 :'4&* y'
>    g=: 13 :'4*& y'
>    h=: 13 :'&*4 y'
>    i=: 13 :'*&4 y'
>
>    f
> 4&*
>    g
> 3 : '4*& y'
>    h
> 3 : '&*4 y'
>    i
> *&4
>
>    5!:4 <'f'
>       -- 4
> -- & -+- *
>    5!:4 <'g'
>       -- 3
> -- : -+- ,:'4*& y'
>    5!:4 <'h'
>       -- 3
> -- : -+- ,:'&*4 y'
>    5!:4 <'i'
>       -- *
> -- & -+- 4
>
>    f 5
> 20
>    g 5
> |syntax error: g
> |       4*&y
>    h 5
> |syntax error: h
> |       &*4 y
>    i 5
> 20
>
> My remaining question is about the trees for  g  and  h  .  How did  the
> ,:  show up in the trees?  What does it mean?  Is it a signal that there is
> a syntax error?
>
> Linda
>
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of km
> Sent: Sunday, March 09, 2014 12:46 AM
> To: [email protected]
> Subject: Re: [Jprogramming] Oddities in Bond including ,:
>
> A suggestion: where do the understood parentheses go in  4&*y  and in  4*&y
> ?  --Kip
>
> Sent from my iPad
>
> > On Mar 8, 2014, at 10:33 PM, "Linda Alvord" <[email protected]>
> wrote:
> >
> > Why is the display of  f  different than  g , h and I ?
> >
> >    NB.  m&v y is defined as m v y
> >
> >   NB. u&n y  is defined as y u n
> >
> >    f=: 13 :'4&*y'
> >
> >   g=: 13 :'4*&y'
> >
> >   h=: 13 :'y&*4'
> >
> >   i=: 13 :'y*&4'
> >
> >   f
> > 4&*
> >
> >   g
> > 3 : '4*&y'
> >
> >   h
> > 3 : 'y&*4'
> >
> >   i
> > 3 : 'y*&4'
> >
> >   5!:4 <'f'
> >      -- 4
> > -- & -+- *
> >
> >   5!:4 <'g'
> >      -- 3
> > -- : -+- ,:'4*&y'
> >
> >   5!:4 <'h'
> >      -- 3
> > -- : -+- ,:'y&*4'
> >
> >   5!:4 <'i'
> >      -- 3
> > -- : -+- ,:'y*&4'
> >
> > Where does  ,:  come from  in the trees for  g , h and I ?
> >
> >
> >   f 5
> > 20
> >
> >   h 5
> > 20
> >
> >   g 5
> > |syntax error: g
> > |       4*&y
> >
> >   i 5
> > |syntax error: i
> > |       y*&4
> >
> > Finally,  only two work.
> >
> > Linda
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to