This is more like complex arguments for i:

There's two different ways of looking at step size: as the total number of
steps needed to complete the series, or as the size of step to take
(specifying one constrains the other).

That said, I think I'd define your 'steps' as:

   steps=: {.@] + i.@>:@[ * -~/@] % [

or maybe even

   steps=: {.@] + i.@>:@[ * -~/@:%~

Almost the same, but rearranged slightly. (I doubt the differences matter.)

Thanks,

-- 
Raul



On Fri, Mar 21, 2014 at 10:50 AM, km <[email protected]> wrote:

> I use
>
>     steps
>  {.@] + -~/@] * [ %~ [: i. >:@[
>     5 steps 2 3
>  2 2.2 2.4 2.6 2.8 3
>
> --Kip Murray
>
> Sent from my iPad
>
> > On Mar 21, 2014, at 9:29 AM, Pascal Jasmin <[email protected]>
> wrote:
> >
> > an alternate approach to increasing step size is:
> >
> >    2 ([ * [: i. ]) 5
> > 0 2 4 6 8
> >
> > ----- Original Message -----
> > From: Raul Miller <[email protected]>
> > To: Programming forum <[email protected]>
> > Cc:
> > Sent: Friday, March 21, 2014 9:34:51 AM
> > Subject: Re: [Jprogramming] A curious omission
> >
> > That's a good point. That ambiguity you called out would indeed be a
> > problem.
> >
> > Meanwhile, the functionality which I was reaching for could be expressed
> as:
> >
> >    (10 $ 2{. 1) # i. 10
> > 0 2 4 6 8
> >
> > or, equivalently:
> >
> >    2 (i.@] #~ ] $ [ {. 1:) 10
> > 0 2 4 6 8
> >
> > Or, better yet:
> >
> >    2 (i.@] #~ ] $ [ {. 1:) 11
> > 0 2 4 6 8 10
> >
> > But what's a word to describe this issue of step size? I'd like to use it
> > with thru:
> >
> >    thru=: <./ + i.@(+ *)@-~
> >
> >    0 thru 10
> > 0 1 2 3 4 5 6 7 8 9 10
> >
> > Perhaps:
> >    stepsize=: ] #~ $@] $ [ {. 1:
> >
> >   2 stepsize 0 thru 10
> > 0 2 4 6 8 10
> >
> >    2 stepsize 10 thru _2
> > 10 8 6 4 2 0 _2
> >
> > Of course, there's a limitation here. If I ask for a step size which
> clips
> > off the ending point, I will not see it in my results. And, there's
> nothing
> > really wrong with using i. directly. Still, this kind of thing can be fun
> > to play with.
> >
> > Thanks,
> >
> > --
> > Raul
> >
> >
> >
> > On Fri, Mar 21, 2014 at 9:11 AM, Pascal Jasmin <[email protected]
> >wrote:
> >
> >> exploring i: with j parameters is very impressive.
> >>
> >> it creates equal intervals from -xj to xj.
> >>
> >> even jy will include 0 in the interval list.
> >>
> >>     i: 10j3
> >> _10 _3.33333 3.33333 10
> >>     i: 10j4
> >> _10 _5 0 5 10
> >>
> >> I can understand not including a i. definition, bc if you wanted
> >>
> >> 0 5 10
> >>
> >>
> >> should you call i. 10j2 or i. 10j4 ?
> >>
> >> The latter keeps the mirror properties of i. and i:, but the result is 2
> >> intervals instead of 4.  It doesn't seem overwhelmingly difficult to
> filter
> >> out the results of i: to get what you want.  Odd jy params are
> interesting,
> >> and might be lost with a definition for i. that strives for conceptual
> >> simplicity relative to its y arguments rather than to i: reference.
> >>
> >>
> >> ----- Original Message -----
> >> From: Raul Miller <[email protected]>
> >> To: Programming forum <[email protected]>
> >> Cc:
> >> Sent: Friday, March 21, 2014 8:06:23 AM
> >> Subject: Re: [Jprogramming] A curious omission
> >>
> >> I was trying to draw a contrast between the domains of i. and i:
> >>
> >> Also, my use of !. (fit) was not meant to be ! (out of). I was talking
> >> about potential language enhancements (which should focus on taking
> error
> >> cases and re-using them for something that makes sense) and not about
> using
> >> the language as it is now. Perhaps I should have used the chat forum,
> given
> >> the subject matter?
> >>
> >> Thanks,
> >>
> >> --
> >> Raul
> >>
> >>
> >>
> >> On Fri, Mar 21, 2014 at 5:09 AM, Linda Alvord <[email protected]
> >>> wrote:
> >>
> >>> Perhaps you meant:
> >>>
> >>> i:2!10
> >>> _45 _44 _43 _42 _41 _40 _39 _38 _37 _36 _35 _34 _33 _32 _31 _30 _29 _28
> >> _27
> >>> _26 _25 _24 _23 _22 _21 _20 _19 _18 _17 _16 _15 _14 _13 _12 _11 _10 _9
> _8
> >>> _7
> >>> _6 _5 _4 _3 _2 _1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
> 21
> >>> 22
> >>> 23 24 25 26 27 28 29 30 31...
> >>>
> >>> Linda
> >>> --
> >>> ---Original Message-----
> >>> From: [email protected]
> >>> [mailto:[email protected]] On Behalf Of Raul
> >> Miller
> >>> Sent: Friday, March 21, 2014 2:22 AM
> >>> To: Programming forum
> >>> Subject: [Jprogramming] A curious omission
> >>>
> >>>     i: 10j2
> >>> _10 0 10
> >>>     i. 10j2
> >>> |domain error
> >>>
> >>> Not quite sure why we can use complex numbers with i: but not i.
> >>>
> >>> Of course it might also be useful to specify the step size instead of
> the
> >>> number of steps. But !. could be used for that:
> >>>
> >>>     i.!.2]10
> >>>
> >>> |domain error
> >>>
> >>>
> >>> Curious...
> >>>
> >>>
> >>> --
> >>>
> >>> Raul
> >>> ----------------------------------------------------------------------
> >>> 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
> >>
> >> ----------------------------------------------------------------------
> >> 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
> ----------------------------------------------------------------------
> 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