The next beta will remove one leading blank line from the display.

Henry Rich

On 1/19/2021 9:22 PM, Ric Sherlock wrote:
In a similar vein,
The first line of a multi-line definition doesn't respect indentation, so:
    mutate=: {{idxmut=. I. x >: (*/$y) ?@$ 0
   (populate idxmut) idxmut"_} y
}}
    mutate
4 : 0
idxmut=. I. x >: (*/$y) ?@$ 0
   (populate idxmut) idxmut"_} y
)
    mutate=: {{  idxmut=. I. x >: (*/$y) ?@$ 0
   (populate idxmut) idxmut"_} y
}}
    mutate
4 : 0
idxmut=. I. x >: (*/$y) ?@$ 0
   (populate idxmut) idxmut"_} y
)

A work-around for the above is not to use the first line, however we then
end up with an extraneous empty line:
    mutate=: {{
   idxmut=. I. x >: (*/$y) ?@$ 0
   (populate idxmut) idxmut"_} y
}}
4 : 0

   idxmut=. I. x >: (*/$y) ?@$ 0
   (populate idxmut) idxmut"_} y
)

Would it be problematic to remove the first line from the definition if it
doesn't contain anything except whitespace or comments? Note that
currently, if the first line contains only comments and whitespace, they
are omitted from the definition.


If we explicitly set the type of definition it works OK.
    mutate=: {{)d
   idxmut=. I. x >: (*/$y) ?@$ 0
   (populate idxmut) idxmut"_} y
}}
    mutate
4 : 0
   idxmut=. I. x >: (*/$y) ?@$ 0
   (populate idxmut) idxmut"_} y
)

None of this impacts anything except keeping things tidy :) !

On Wed, Jan 20, 2021 at 11:08 AM Henry Rich <[email protected]> wrote:

Starting with the next beta JE will remove excess trailing blanks at the
end, leaving just one space.

Henry Rich

On 1/19/2021 1:18 PM, John Baker wrote:
Direct definition has added another, more convenient way to define local
J
words
on the fly. It is particularly useful for creating verbs, adverbs and
conjunctions
within explicit definitions.

However there are gotchas. One thing I've noticed is the repeated
addition
of a
trailing blank to DDs within words when you redefine a word. Consider:

ddblanks=: 3 : 0


NB.*ddblanks v-- show blank addition for local DDs.


NB. local dd verb

dad=. {{x + y}}

x dad y

)


Now fetch and redefine the word - JOD does a lot of this:


0!:0 'ddblanks=:' , 5!:5 <'ddblanks'


Every time the previous line is executed another blank is appended to the
local DD.

After half a dozen applications ddblanks looks like:

3 : 0


NB.*ddblanks v-- show blank addition for DDs.


NB. local dd verb

dad=. {{ x + y }}

x dad y

)


I can understand the need to add a trailing blank once but is it
necessary
to keep doing this?



--
This email has been checked for viruses by AVG.
https://www.avg.com

----------------------------------------------------------------------
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