> Wow, that was fast.  I received your reply 10 minutes
> after I sent my question, so your implementation and
> testing had to take considerably less time than that.

FYI:  the changes to the source to implement the function
are as follows:
    ...
 switch(v->id){
  case CPOUND: f1=jtiota1; break;
    ...
The C function that implements f\ already had a big switch
for various special cases.  The new case CPOUND
adds the hook for the #\ case.  f1 is the C function
that implements the monad for f\ .

The interpreter already had a function apv(n,a,b)
for computing the arithmetic progression vector a+b*i.n
and, for an array w, the macro IC(w) (item count) 
gives #w as a "long".  Therefore:

static DF1(jtiota1){R apv(IC(w),1L,1L);}

Similar thing for #\., with

static DF1(jtiota1rev){R apv(IC(w),IC(w),-1L);}

I did not bother to add anything to the test scripts
for these changes.



----- Original Message -----
From: Raul Miller <[email protected]>
Date: Thursday, August 5, 2010 9:24
Subject: Re: [Jchat] #\
To: Chat forum <[email protected]>

> On Thu, Aug 5, 2010 at 11:56 AM, Roger Hui <[email protected]> wrote:
> > Done.
> >
> >   #\ 10 4$'ten four'
> > 1 2 3 4 5 6 7 8 9 10
> >
> >   x=: i.1e6
> >   ts '#\x'
> > 0.00933387 4.19501e6
> 
> Wow, that was fast.  I received your reply 10 minutes
> after I sent my question, so your implementation and
> testing had to take considerably less time than that.
> 
> Thank you!
> 
> That said, if you have not already done so, perhaps you
> could at some point give #\. similar treatment?
> 
> (I believe I have used >:@i...@-@#  occasionally, though
> I do not have a convenient way of searching for references.)
> 
> Thanks again,
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to