label_. currently serves line splitting function in explicit code. Shortening
that to .. equivalent "is easy".
functionality that would appeal to me from a "special word" (not conj/adv or
other speech) is as a separator that acts as parentheses, and works with tacit
code:
myfunction =: exp1 .. exp2 NB. .. leading on next line indicates a line join
instead of a split, with this comment stripped from full expression .. exp3
would be equivalent to
myfunction =: ((exp1) (exp2)) (exp3) NB. where .. line joining start of line
indicator also parenthesizes full prior expression.
a trailing (right) dangling .. would not parenthesize the previous expression.
I'll note that embedding a comment anywhere is pretty easy with:
NB =: 2 : 'u'
+/ NB 'sum' 1 2 3 NB commentwordunquoted
6
+/ [. 'sum' 1 2 3 NB. 903 equivalent.
6
I've posted about jpp extensions that I've made that reduce quoting and
parenthesizing. I make heavy use of separator (non speech). I hijack ` an use
"ti" as a gerund builder. It might be better than this proposal.
On Saturday, April 1, 2023 at 09:52:33 a.m. EDT, Raul Miller
<[email protected]> wrote:
Control words also work as line separators.
So introducing a no-op control word (perhaps a single letter followed
by a dot) would scratch most of that itch.
Making control words work outside of explicit definitions (either this
single example, or maybe a more complete entourage) would require more
extensive changes, comparable in scope perhaps to the [{ }} effort.
But maybe that's worth doing also?
As for a line joiner... I'm tempted to suggest nb. followed by
arbitrary text which would be ignored. My experience with multi-line
expressions is that it becomes quite annoying to comment them. And we
could head that off by making the line joiner also be a comment to
end-of-physical-line "token".
The line joiner would also be "explicit only" unless (at least some)
explicit syntax was allowed at the command line.
Thanks,
--
Raul
On Sat, Apr 1, 2023 at 5:26 AM Elijah Stone <[email protected]> wrote:
>
> Some time ago, Michal proposed that a line separator be added. I want to
> rekindle that discussion. The proposal was that .. behave like a line break
> when placed on a single line, such that e.g. {{ a=. y+y .. a }} 2 would do the
> obvious thing. Short, distinctive, and to the point.
>
> I also want to propose a line _joiner_, analogous to \ in shell or c: ...,
> placed at the beginning or end of a line should join it with the previous or
> next. Joining lines happens _after_ stripping comments, unlike the other
> languages I cited; the goal is to enable large, multi-line definitions with
> commentary for intermediate terms, without the need for pointless intermediate
> definitions.
>
> It might be objectionable to use such similar symbols for separators and
> joiners. But maybe it's not such a big deal. Two more ideas:
>
> 1. Could use the _same_ symbol for both, with its sense depending on where
> it's placed in a line.
>
> 2. Separator could be .:.; metaphor: a hill stops the interpreter in its
> tracks.
>
> I don't like 2 because the larger the separator is, the more annoying it is to
> use. Joiner can afford to be large, since it only comes into play if the rest
> of the line is sufficiently large.
>
> Anyway--thoughts? Comments? Suggestions?
>
> -E
> ----------------------------------------------------------------------
> 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