I think I can address some of your questions (but my statements will
not be in order):

(*) The fold conjunction is a generalization of the (/) adverb. It was
designed to address a number of issues which have been encountered
over the years. Only time will tell how useful it may become.

(*) The current implementation is a prototype. The parsing stage is
hard-coded into the interpreter, but the actual implementation is
"just plain old J". So that 'whole lot of "code"' you're seeing is the
actual current (prototype) implementation of Fold.

(*) While the J parser supports both one character tokens and multiple
character words, much like most other languages, it also does a few
things differently, including:

((+)) The . and/or : character can extend an existing token. These are
analogous to inflection marks used with human languages. Thus, A:::::
has always been recognized by the parser as a token -- it just has
never had any meaning assigned to it.

((+)) Any alphabetic character can be a part of a number, not just e.
Thus, 1xyz0 has always been recognized by the parser as a number -- it
just never has had any meaning assigned to it.

((+)) Spaces can be part of a numeric word. Thus 1 2 3 is a single
word in the parser, which is a list of numbers. This is analogous to
how '1 2 3' is a single word in the parser, which is a list of
characters -- it just has a different length.

(*) The documentation can be improved.

Thanks,

-- 
Raul

On Wed, Jul 8, 2020 at 8:13 AM Piet de Jong <[email protected]> wrote:
>
> I've been experimenting with the new fold conjunction F:.  .   I think it's a 
> very useful addition to J and thank all those who have made this  possible.   
> Nevertheless I have some comments/reactions.    These are made in a 
> constructive spirit.   Perhaps  these comments just display my own ignorance 
> and J ineptitude.   I make these comments as someone who has worked in Kalman 
> filtering and smoothing which seem perfect candidates for  Fold.   In fact I 
> implemented Kalman filtering with F:. and found a dramatic increase in both 
> computational speed and ease of coding, and a drastic reduction in J code 
> clutter.
>
> 0)   Is the monadic case useful?     To my mind it just creates potential  
> confusion and "clutter":   most iterations can be thought of as an initial 
> condition (x) with iterations which  consume y.
> 1)   Why have Fold forward AND Fold reverse.    Can't you  just have Fold 
> forward leaving the reverse to be treated as (u F:. v |.)   I realise this 
> assumes the dyadic case  (see 0)
> 2)   When you type u F:. v into the interpreter I  get a whole lot of "code" 
> rather than the usual boxed representation.    Is this intentional?
> 3)  I made the comment in a previous post that the switching of x an y 
> between (u F:. v) and v is very confusing to me.   It just doesn't seem 
> natural.  The x in x (u F:. v) y is the natural "initial condition".   In 
> each iteration the "natural" initial condition is the output of the previous 
> iteration and I suspect most people would think this way.
> 4)  Is F.. really useful?   Why can't users just implement {:@(u F:. v), 
> picking off the last result.
> 5) The documentation section "which primitive should I use",  refers to F:... 
>  -- I don't understand what the three dots stand for.  Nor do I understand 
> what eg "Fold Multiple *" means (ie the *).
> 6)  The documentation section "Common uses" part 1, gives, according to me a 
> confusing and perhaps non constructive example.   The y  (from the point of 
> view of u F:. v ) sequence is not used at all other than being printed out 
> (as the x of v).      Perhaps a more instructive  example would be iteration 
> of the form z_t=1/z_{t-1} + y_t.
> implemented as  (]F:.((%@[+])~)).   (As per 3 I really dislike having to use 
> ~)
> 7)  Somewhere in the documentation it states that "The first application of v 
> consumes 2 items of y."    If I understand things correctly this is only true 
> for the monadic case.
> ----------------------------------------------------------------------
> 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