Personally, I do not find |. 3 $ |. n easier to read at a glance. than 3&$&.|. n
But I think your point is that by reducing the vocabulary expected of the reader, you open the door to a larger audience. But, given that the vocabulary of J is rather small to begin with, and given that you are still going to have to be able to read J to understand J sentences, I am not sure how significant this effect can be. -- Raul On Tue, Nov 29, 2011 at 11:51 AM, Kip Murray <k...@math.uh.edu> wrote: > Let me try. > > The expression 3$&.|.n occurs on the Vocabulary page for Rank u"n . > From the definition of &. we can decipher that > > 3 $&.|. n is |. (|. 3) $ (|. n) that is |. 3 $ |. n > > Isn’t that last easier to understand at a glance? > > Simple J prefers trains with no conjunction other than Rank " . > > Expressed in Simple J the verb applied to n is [: |. 3 $ |. . > > Perhaps a better name would be Beginner's J. Keep the syntax simple, > make ranks explicit when you need to think about them. Eventually you > will need to graduate from Beginner's J. > > > On 11/29/2011 9:35 AM, Tracy Harms wrote: > > Linda, > > > > It does not seem to me that rephrasing to avoid @ (rank-zero composition) > > makes expressions simpler, either in this specific case or in general. > > > > If you'd like to elaborate on why that seems simpler to you, I'd like to > > hear your perspective. > > > > --Tracy > > > > > > On Sat, Nov 26, 2011 at 9:46 AM, Linda Alvord<lindaalv...@verizon.net > >wrote: > > > >> A function that works. It is not simple. Remove the @ > >> > >> Linda > >> > >> -----Original Message----- > >> From: programming-boun...@jsoftware.com > >> [mailto:programming-boun...@jsoftware.com] On Behalf Of EelVex > >> Sent: Saturday, November 26, 2011 9:15 AM > >> To: matxinle...@hotmail.com > >> Cc: Programming forum > >> Subject: Re: [Jprogramming] FW: A simple function > >> > >> On Sat, Nov 26, 2011 at 11:29 AM, m l<matxinle...@hotmail.com> wrote: > >> > >>> > >>> I`m a beginner in J programming. > >>> I need writing a simple function: > >>> > >>> round ( x * sqrt (x*y)) > >>> > >>> Thanks in advance. > >>> > >>> Matxin > >>> > >>> > >> Among the gazillion ways to do this: > >> > >> f =: [:<.0.5+ {. * %:@*/ > >> f 15 30 > >> 318 > >> ------ > >> 1. If you have a list of two numbers: x,y, you multiply them with `*/`: > >> */ 15 30 > >> 450 > >> > >> 2. You then take the square root (`%:`) of (`@`) that: > >> (%: @ */) 15 30 > >> 21.2132 > >> > >> 3. and multiply that by the first term of your list (`{.`) > >> ({. * (%: @ */)) 15 30 > >> 318.198 > >> > >> 4. You then "apply" (`[:`) rounding (`<.0.5+`) to that: > >> ([:<.0.5+ {. * (%:@*/)) 15 30 > >> 318 > >> > >> Note that the construct in step 3 is a train of 3 verbs (see: > >> http://www.jsoftware.com/help/learning/09.htm). > >> (f g h) y == (f y) g (h y) > >> where > >> y = 15 30 > >> f = {. (take first) > >> g = * (multiply) > >> h = %:@*/ (square root of product) > >> > >> Also, you round a number n by taking the floor of (n + 0.5). > >> > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm