On Thu, Oct 15, 2009 at 4:58 PM, Eldon Eller <[email protected]> wrote: > NB. stdval R returns the standard 1% resistor value nearest R. > > stdval=.10&^...@c*100&nrnd@(10&^@(96&(nrnd=.([:%[)*[:<.0.5"_+*)@(log-c=.[:<.log=.10&^.))) > > This is probably not very good code; suggestions would be appreciated. > My question is this: I have rarely if ever seen the copula used in tacit > code on the J programming forum. It clearly is possible. Is this > considered bad practice, and, if so, why?
Usually its easier to find names if they are on the left hand side of the screen. Also, some people do not like wide windows. Anyways, here's how I would write what you have written. log=: 10&^. nrnd=: [ %~ 0.5 <....@+ * stdval=: <.&.log * 100 nrnd 96 nrnd (- <.)&.log I have not tried to analyze your algorithm for alternative ways of achieving the same result. I am using =: because =. will not provide definitions in some contexts. (Like, when your script gets loaded inside a verb.) I am using &. where it seemed appropriate. I am using J's (m u v) style forks, where a noun is automatically treated as a constant verb when it's the left tine of a fork. FYI, -- Raul ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
