and the last expression as a "parameterized function" that is adverb instead of 
dyad

2 (,^:)~ 1 2 3

1 2 3 1 2 3 1 2 3






On Thursday, January 27, 2022, 09:11:22 a.m. EST, 'Pascal Jasmin' via 
Programming <[email protected]> wrote: 





J has a repeat conjunction ^:    A repeat adverb that repeats n times is (^:n) 
or to use x instead of n (^:[)

this won't behave as your original function, but produces the square of x 
copies of y.  ie. each function call changes/expands y such that the next call 
is on the larger y


2 ,~@]^:[ 1 2 3

1 2 3 1 2 3 1 2 3 1 2 3

but using ^:n instead of x, frees up x to be a constant to each call.  for n = 
x-1 in your original function  

,(^:2)~ 1 2 3

1 2 3 1 2 3 1 2 3

this repeats appending the original y to the "expanded each iteration/repeat 
result" n times.




On Thursday, January 27, 2022, 08:55:33 a.m. EST, Pawel Jakubas 
<[email protected]> wrote: 





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

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

Reply via email to