Ahhh - in real estate it's location location location - in 
programming it's context context context. Part of my confusion came 
from assuming that your original post described experiments you had 
run - and noting that you seemed to purport a result from -

    (/.~) 0 1 2 0 1 3 3 3 3

instead of the syntax error that phrase (as given) actually produces, 
I lost track of what you were trying to do. A reference (such as 
below) to the source of the definition you were analyzing would have 
kept the train of thought on the tracks. Thanks for showing the 
context of what you were trying to understand.

A couple of comments in the spirit of concision - in lieu of  (_20 + 
(i.9)*5)  you might enjoy discovering i: 20j8

   (_20 + (i.9)*5) -: i: 20j8
1

in the same expression - )'s at the end of statements are redundant. 
Of course, for exposition they may be desirable. e.g. my example 
above might be (a little) clearer as (_20 + (i.9)*5) -: (i: 20j8) ...

In any case, thanks for sharing what you were trying to explore.


At 13:57  +0000 2009/02/21, Steven Taylor wrote:
>histogram=: <: @ (#/.~) @ (i...@#@[ , I.)   NB. histogram verb from
>http://www.jsoftware.com/help/dictionary/dicapdot.htm.<http://www.jsoftware.com/help/dictionary/dicapdot.htm>
>
>a =:(_20 + (i.9)*5)           NB. intervals from minus -20 to 20 in steps of
>5
>b=:(+/\ 5 - ?. (20 $ 10))   NB. a simple random walk
>[c=:a histogram b
>0 0 0 2 8 6 2 1 1
>    load 'plot'
>    plot a;c
>
>The point of the exercise for me at least is syntax, to appreciating concise
>definitions, and to figure out verb trains.  I like the idea of putting lots
>of concise functionality on one line, but I'm not sure that many places
>would entertain the idea.
>
>Steven
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to