[Jprogramming] function within function; scope

Rudolf Sykora rsykora at disroot.org
Fri Mar 20 21:59:26 UTC 2020


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.


More information about the Programming mailing list