Roy A. Crabtree <roy.crabtree <at> gmail.com> writes:

> 
> Instead of
> 
> (((A pp 2) pp 3) pp4)...
> 
> what if you stated it as
> 
> 4 pp 3 pp 2 pp A
> 

> iii) scan apply it to A.

I looked on the wiki for a scan tutorial and found this:
http://www.jsoftware.com/jwiki/OlegKobchenko/Ways_to_Scan?highlight=%28scan%29

but then I immediately hit a problem.
c=. '(' , [ , ')' ,~ ]
   'a' c 'b' c 'c'
(a(bc))

That was all well and good, but I wanted a more "pictorial" way to form the
string, so I tried to move the "]" inside the parenthesis, since that is what c
does... 'b' c 'c' creates (bc) and so I wanted the verb to look the same way 
too.
So I tried:
c=. '(' , [ , ] , ')'
but I got a syntax error when I tried to run it.

At first I thought this was because I was supplying "," with a verb argument and
it only takes two nouns... i.e., ')' , ] works because "]" gets the right arg
and returns a noun so that , has two nouns to work on.

But if that is the case then after ')' ,~ ] we have [ , 'c)' which means that 
"," still has to work on a verb argument as opposed to a noun argument.

So why is it that [ , 'c)' will work but my attempt to have
] , ')' work will not?


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to