On reading your message again, I think your meant,
inc2 =: 2&+
app2 =: 1 : '(] , x@{:@])'
inc2 app2 2 4 6
2 4 6 8
inc2 app2^:5[2 4 6
2 4 6 8 10 12 14 16
but this is an iteration, not a recursion.
Пнд, 28 Мар 2011, bill lam писал(а):
> There is no recursion in inc2 or app2.
> app=: ] , {:
> inc2=: 2&+
> (2&+) (] , {:) 2 4 6
> (2&+) 2 4 6 6
> 4 6 8 8
>
> For recursion, it needs $: or name refering it own name directly or
> indirectly. such as
> rev=: ]`({: , rev@}:)@.(0~:#)
> rev i.10
> 9 8 7 6 5 4 3 2 1 0
>
>
> Пнд, 28 Мар 2011, Adrian May писал(а):
> > Hi again,
> >
> > Now I'd like to remove that printing hack in my program. I knew it was a
> > hack and it won't help with the next bit.
> >
> > In principle, I want to build a list recursively using some function to
> > generate each element from the previous one, up to a certain length. I tried
> > it with /\ but just got strange results:
> >
> > (2*[)/\ 2 3 4
> > 2 4 4
> >
> > and had trouble doing it the long way:
> >
> > inc2 =: 2&+
> >
> > app =: (] , inc2@{:@])
> > app (2 4 6)
> > 2 4 6 8
> >
> > app2 =: (] , [@{:@])
> > inc2 app2 (2 4 6)
> > 4 6 8 8
> >
> > I don't understand what's happening here. Please help. Isn't there something
> > out of the box for this?
> >
> > Adrian.
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
>
> --
> regards,
> ====================================================
> GPG key 1024D/4434BAB3 2008-08-24
> gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm