There was domain error becasue q: cannot take 0 as its argument. Similarly
q:1 will return an empty list so that your phi will raise errors even for
scalar 0 and 1.

Пнд, 12 Сен 2011, David Vaughan писал(а):
> Hi,
> 
> I have defined a verb like so:
> 
>    phi=: 3 : 'y%#(>:i.y)-.,(>:i.y)*/(y$q:y)'
> 
> It seems I can only use with atoms, e.g.
> 
>    phi 6
> 3
> 
> What I want to be able to do, is apply this verb to a list. I would also like 
> to know how I can define verbs so they can be more flexible in this way in a 
> general sense.
> 
> This is the output of my failed attempt:
> 
>    phi i.6
> |domain error: phi
> |   y%#(>:i.y)-.,(>:i.y)*/(y$    q:y)
> 
> I can kind of see where the problems may be, but I can't think how to 
> eradicate them - this is the sort of thing I would usually be just using  
> loop for in a C type language, but I would dearly love to know the best J 
> style approach. Also, I find that these error messages are difficult to 
> interpret - I'm not clear where the error has been found, but I assume the 
> large space has something to do with it (any advice here would be helpful).
> 
> Thanks in advance.
> ----------------------------------------------------------------------
> 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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to