I'm not sure exactly what you are trying to do, but if it is
10 - 4 * i. 4
10 6 2 _2
Then you could make a verb that named 10 as x and 4 as y thusly -
cd =. 4 : 'x - y * i. y'
cd
4 : 'x - y * i. y'
10 cd 4
10 6 2 _2
100 cd 10
100 90 80 70 60 50 40 30 20 10
If you want a tacit form, you can let j generate it -
cd =: 13 : 'x - y * i. y'
cd
[ - ] * [: i. ]
10 cd 4
10 6 2 _2
100 cd 10
100 90 80 70 60 50 40 30 20 10
cd 5
5 0 _5 _10 _15
cd 10
10 0 _10 _20 _30 _40 _50 _60 _70 _80
- joey (also :)
At 21:49 +0000 2007/12/02, Joey wrote:
Hello J-ers!
I have only been working with J for a week or so now, so I am still getting
to grips with all the concepts and verbs etc.
I am trying to get a running countdown. Of which, I thought I could maybe
use something like:
(4&+)/\ (4#10)
but this does not produce the correct results.
I finally found :
(4 : 'y-4')/\ 4#10
but I had wondered if there was a better way to do this, since it doesn't
look very nice.
Now I want to create a verb, based on the above, so that I could change the
value of 4. I tried :
2 (4 : '(4 : ''y-x'')/\(4#y)') 10
again this is very ugly, and doesn't even work!
Thanks alot,
Joey
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm