a. What is "scan"?  If it is f/\ and f/\. then
there is little meaningful to be said in addition
to what I have already said:  If the interpreter
"knows" that f is associative f/\ is fast, i.e. 
O(n); if not, f/\ is O(n^2).  In contrast, f/\. 
is always O(n).

b. What is "direct single pass scan" and what is
"alternative multiple scan"?  

c. If "this problem" is the one originally posed
-- repeat a non-fill item until the next non-fill
item -- then I disagree that it takes a lot of
effort to figure out in J.  Since you said that
"this problem seems very trivial" in C, then 
perhaps I am entitled to tell you that I solved 
the problem instantly in J.  (I mean that I got 
the crux of the solution instantly.  Actually
programming it would probably have taken 5 
minutes or so.)

d. If you mean by "that reference" "Appendix B:
Special Code" of the dictionary, then I should 
point out that Appendix B has been mentioned 
just recently in this forum.  

Anyway, if you care about efficiency, then
Appendix B is a standard place to look.  
On the other hand, it is also reasonable to 
program in J without regard to Appendix B,
and then tell us about it if your J program 
is slower than you expect.  (Whence most likely
we will clear up your misconceptions :-)

Many the items in Appendix B came about when I 
do benchmarks on programs submitted to the Forum 
by people whom I respect, and they ran slower than
I expect.  A number of them are "JKT specials";
perhaps in time there will be a few "OK specials".

e. Pepe's tools are indeed cool.  See also Sample 
Topic 19 in the dictionary:
http://www.jsoftware.com/help/dictionary/samp19.htm
You know, you really should read the documentation
sometimes. :-)



----- Original Message -----
From: Oleg Kobchenko <[EMAIL PROTECTED]>
Date: Wednesday, December 13, 2006 4:38 pm
Subject: Re: [Jprogramming] What a drag

This is understood. What I meant by systematic is
that Scanning is one of fundamental properties of
J programming, as in "loopless code". Also it is
generalized from classic APL.

So it would explore different types of scan as in
Jose's examples and examine what properties and
constraints they have. Such as when direct single pass
scan would be inefficient compared with alternative
multiple scans.

This problem seems very trivial, at least for C code.
Yet in J it requires a lot of effort to figure out.
It would be good, next time, just to point to that
reference.

Is it possible, or it's like to ask for a program
that does anything?

I also liked Jose's tool to construct and visualize
application of verbs to arguments. It would also be
good to centralize a collection of various such tools
in a toolbox in Wiki. ts is another such tool,
Primitives to Mnemonics, etc.


--- Roger Hui <[EMAIL PROTECTED]> wrote:

> Appendix B of the dictionary
> http://www.jsoftware.com/help/dictionary/special.htm
> says that:
>
> +/\  monad          also * and - ; on Windows, assembly code for integer 
> arguments
> +/\.  monad          also * and - ; on Windows, assembly code for integer 
> arguments
>
>
>
> ----- Original Message -----
> From: Oleg Kobchenko <[EMAIL PROTECTED]>
> Date: Wednesday, December 13, 2006 1:32 pm
> Subject: RE: [Jprogramming] What a drag
>
> > OK. So +/\ is special code then.
> > Thanks, Raul and Jose.
> >
> >   Q=: _2+?1000$5
> >   (+/\ -: ([+])/\) Q
> > 1
> >   (+/\ -: ([+])~/\.&.|.) Q
> > 1
> >   ts '+/\ Q'
> > 1.02999e_5 5248
> >   ts '+/\.&.|. Q'
> > 1.50313e_5 9728
> >   ts '([+])/\ Q'
> > 0.311365 18304
> >   ts '([+])~/\.&.|. Q'
> > 0.000485823 10496
> >
> >
> > Still, it's kind of murky.
> > Is there a link where it is systematically treated?
> >
> > Also here is a relationship,
> >
> >   -/\1 2 3 4 5
> > 1 _1 2 _2 3
> >   -/@|.\.&.|.1 2 3 4 5
> > 1 _1 2 _2 3
> >  
> >   -/\.&.|.1 2 3 4 5
> > 1 1 2 2 3
> >   -/@|.\1 2 3 4 5
> > 1 1 2 2 3


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

Reply via email to