Early versions of J had a computed goto.

It was an interesting concept -- instead of "goto" a line, and then
proceed incrementally, it was "goto this sequence of lines (and then
you're done)". So, if you had a 10 line verb, with a line label for
line 4, and a test point on line 8, the computed goto might goto 4 5 6
7 8 (or, equivalently, 4 5 6 7 8 9, since at line 8 you would get
another computed goto... though it might also just send you to line 9)

It was removed.

While it was an interesting concept the necessary infrastructure
wasn't built up around it. Line labels should have been a sequence of
line numbers up to the last line of the verb. I don't recall if that
was implemented that way. But, also, other control structures probably
should have been defined to incorporate this mechanism, and possibly
meaningful names should have been chosen for common operations.

Instead, it was just treated as more complicated than useful, and scrapped.

FYI,

-- 
Raul

On Sat, Feb 15, 2020 at 3:30 PM 'Jim Russell' via Programming
<programm...@jsoftware.com> wrote:
>
> Thank you, Devon, for bringing gerunds into this discussion.
> An exchange here a while back reminded me of an inept COBOL programmer who 
> created several pages of IF statements where a single "go to depending on" 
> would have been much more efficient.  After I  made an (admittedly 
> unsolicited) comment on the topic, I was reminded that J doesn't have a 
> computed goto.
>
> I briefly looked into the J "case." documentation and feared (perhaps 
> incorrectly; I'll look closer) the inefficient approach was being 
> institutionalized.
>
> When long ago I first read (Rogers?) excellent article on case statements:
>  https://www.jsoftware.com/help/phrases/case_statements.htm
> I was focused only on primitive verbs, and wasn't sufficiently imaginative to 
> think of many applications.
> That is probably because I come from a compiled language world where 
> executing a source language statement, if even possible, was frowned upon as 
> kludgey and inefficient (and dangerous, ala SQL.)
> But in a J interpreted world, my guess is that the gerund approach should be 
> much preferred.
>
> > On Feb 14, 2020, at 8:47 PM, Devon McCormick <devon...@gmail.com> wrote:
> >
> > f0=. 3 : 'echo ''this''[y'"0
> > f1=. 3 : 'echo ''that''[y'"0
> > f2=. 3 : 'echo ''etc''[y'"0
> >
> >   f0`f1`f2 @.]"0]i.3
> > this
> > that
> > etc
> >
> >> On Fri, Feb 14, 2020 at 4:58 PM PMA <armst...@eskimo.com> wrote:
> >>
> >> Ahhhhhhhhh, beautiful, thank you!!!
> >>
> >>> On 02/14/2020 04:33 PM, Julian Fondren wrote:
> >>>   TEST =: 3 : 0
> >>>     for_NAME. y do.
> >>>       select. NAME
> >>>       case. 0 do. echo 'this'
> >>>       case. 1 do. echo 'that'
> >>>       case. do. echo 'etc'
> >>>       end.
> >>>     end.
> >>>   )
> >>>
> >>> as used:
> >>>
> >>>      TEST i.3
> >>>   this
> >>>   that
> >>>   etc
> >>>
> >>> That's the second 'for' at
> >>> https://code.jsoftware.com/wiki/Vocabulary/fordot
> >>>
> >>> On 2020-02-14 15:25, PMA wrote:
> >>>> Hi J Gurus,
> >>>>
> >>>> Please forgive an awfully naive question.
> >>>> Here it is in sorta-J context --
> >>>>
> >>>> TEST =: 3 : 0
> >>>>  For each item (an integer) in y
> >>>>  do.
> >>>>    How can I NAME the item, in order to
> >>>>    select. NAME and then run
> >>>>      case. 0 do. this
> >>>>      case. 1 do. that, etc., against it?
> >>>>    end.
> >>>>  end.
> >>>> )
> >>>>
> >>>> Thanks in advance,
> >>>> Pete
> >>>> ----------------------------------------------------------------------
> >>>> 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
> >>
> >
> >
> > --
> >
> > Devon McCormick, CFA
> >
> > Quantitative Consultant
> > ----------------------------------------------------------------------
> > 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