Hmm... I'd phrase that differently: J's blocks are a strict (or maybe 'flat') abstraction that do not inherit from other blocks.
Local names (as opposed to locale names) are specific to the block they were created in, That said, the underlying concept is, I think, the same. Thanks, -- Raul On Fri, Mar 20, 2020 at 6:20 PM Henry Rich <[email protected]> wrote: > > J has no concept of block scope. locales provide namespaces, so public > assignments are not truly global but only visible within the locale; but > for something small like what you are talking about you just can't do it. > > Henry Rich > > PS You CAN actually get to g's b from the function f, using a feature > added within the last year. But I'm not sure Ken would approve so I'm > keeping it to myself. > > hr > > On 3/20/2020 5:59 PM, Rudolf Sykora wrote: > > Dear list, > > > > > > although I seem to be able to define a function within another function, > > it seems that the inner function does not see private variables from the > > outer one. What is then the correct way to write something like > > > > g =: 3 : 0 > > b =. 2*y > > f =. 3 : 'y-b' > > f y > > ) > > > > g 2 > > > > and get -2 as a result? > > > > Here one can change b =. to b =: , but this makes b completely public, > > and that's not particularly nice... > > > > > > Thanks > > Ruda. > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > > > -- > This email has been checked for viruses by AVG. > https://www.avg.com > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
