Yes, I found [ -(i.4) * ], soo after your post.
I am using that particular code here:
f =: 3 : 'x:+/y -(i.4)*] (%:y)+_1'
1++/f"0 *:>:2*>:i.500
Which is #28 on Project Euler, which I am using to learn J!
I tried f =: 13 : 'x:+/y -(i.4)*] (%:y)+_1', then f; but the result was
boxed, and I wasn't sure how it should be formatted.
So how can I replace the definiton of f, into 1++/f"0 *:>:2*>:i.500.
And are there any things I am doing wrong in my code?
Thanks,
Joey
On Dec 2, 2007 10:37 PM, Joey K Tuttle <[EMAIL PROTECTED]> wrote:
> Well then,
>
> verb =: [ - 0 1 2 3 * ]
>
> should make you smile.
>
> - joey
>
> At 22:22 +0000 2007/12/02, Joey wrote:
> >Thank you for that, it is close, but not exactly what I am trying to do!
> >
> >The number 4 does not change, but the number being subtracted does.
> >For example,
> > 9 verb 2
> >9 7 5 3
> >
> > 25 verb 4
> >25 21 17 13
> >
> >I hope you can understand what I want know, but Ill try play with your
> >example, see if I can get it to work.
> >
> >Thanks,
> >Joey (the other one this time!)
> >
> >On Dec 2, 2007 10:12 PM, Joey K Tuttle <[EMAIL PROTECTED]> wrote:
> >
> >> 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