Can't get on this trains ... 
Author Message
 Can't get on this trains ...


Randy MacDonald writes on Saturday, July 29:

Quote:
> From programming in J (Kenneth E. Iverson ISI 1992)

> definition of a conjunction hcb; the expression f hcb g y applies
> f to the head of y and catenates the result with the result of g
> applied to the rest (behead) of y. For example:
>    ! hcb (*/)5 1 2 3 4 5
> 120 120
>  ... but when I use the parsing rules, I get a different beast:


>         v ((cv)`(cv)`(cv)\) v
>         v ((cv) (cv) (cv) ) v
>         v ( a    a    a   ) v
>         (((v a) a) a) v

> What am I missing?

As explained in "Programming in J" in the paragraph immediately
following the quoted passage (page 33), hcb is of the form  
a c a c a a which, because such a train groups to the left, is
equivalent to ((a c a) c a) a.  The grouping would also be
apparent in the boxed or the tree display for hcb.

f hcb g







The trains c v c and c c v added since Programming in J was
published in 1992, make possible a simpler defn of hcb, as the
translator demonstrates:


   hcr

In this the linear display, the heuristics for parenthesization
can be improved, as I myself would have put in the redundant

are helpful in elucidating the structure of the defn.  Thus:

   5!:2 <'hcr'
+---------+-+---------+
|+--+-+--+|,|+--+-+--+|

|+--+-+--+| |+--+-+--+|
+---------+-+---------+
   5!:4 <'hcr'
      +- [.

  |   +- {.
--+- ,    
  |   +- ].

      +- }.



Sun, 18 Jan 1998 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Using CGI module with 'canned queries'

2. It's not bad canned meat...

3. It's not bad canned meat...

4. It's not bad canned meat...

5. It's not bad canned meat...

6. Teacher training on computers 'poor'

7. CA Cans VO ?

8. Variable number of 'gets'

9. C5.5 ABC getting 'My Computer'

10. Using 'gets' with SciTe under Win2000

11. getting rid of '{}'

 

 
Powered by phpBB® Forum Software