Is something like this what you want?

   repeat =: 4 : 0
  rshowx =. 'This is x inside repeat:',LF, ": x
  rshowy =. 'This is y inside repeat:',LF, ": y
  f =. [;@#{.@]
  d =. y
rshowf =. 'These are x and y for f; and its result:',LF,,LF,.":x (;;f) d;d
  rshowx,LF,rshowy,LF,rshowf
)
   3 repeat >:i.3
This is x inside repeat:
3
This is y inside repeat:
1 2 3
These are x and y for f; and its result:

┌───────────────┬─────────────────┐
│┌─┬─────┬─────┐│1 2 3 1 2 3 1 2 3│
││3│1 2 3│1 2 3││                 │
│└─┴─────┴─────┘│                 │
└───────────────┴─────────────────┘
   d
|value error: d
   f
|value error: f
   type <'d'
┌───────────┐
│not defined│
└───────────┘
   type <'f'
┌───────────┐
│not defined│
└───────────┘



Am 27.01.22 um 14:55 schrieb Pawel Jakubas:
I am wondering how to embed definition of `f` inside `repeat`. so I would
call `x repeat d` and inside this function `x f (d;d)` would be called. On
both levels, repeat and f, we have names x and y.And I wonder what are the
techniques to (a) reuse them at both `repeat` and `f` level, (b) separate
them, for example x on `f` definition level is not the same as in `repeat`
level.

Thanks,
Pawel
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

--
----------------------
mail written using NEO
neo-layout.org
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to