Usually, when I am working with multi-line numeric constants, I give
the thing a name so that I can use it in multiple sentences.
That said, if I wanted to use the thing and then forget it, and I
didn't have a convenient small expression to express the numbers, I
would probably do your example like this:
3+0".>cutLF {{)n
2 -7 3
4 0 4
}}
5 _4 6
7 3 7
Or, maybe:
3+0 do>cutLF {{)n
2 -7 3
4 0 4
}}
5 _4 6
7 3 7
If I concerned about efficiency, so that that (>every) was an
advantage, I think I'd go with 0&".;._2 instead of 0 ".>cutLF
Still... I think I agree with your point that some name which screams
"unquoting this numeric matrix" would be nice for presentation
purposes.
As an aside, fix_jzplot_ (from load'plot'), fix_ppublish_ (from
load'format/publish') and num_cal_ (from load'math/cal') would all be
partial candidates here (except for being a bit too verbose). And, of
course, we could do something like:
fixmat=: {{ _ ".>cutLF y }}
Coming up with good names is probably the hardest part of this exercise.
Thanks,
--
Raul
On Wed, Aug 10, 2022 at 9:20 AM Brian Schott <[email protected]> wrote:
>
> Jared's post reminded me how awkward it seems to get multi-line numeric
> data into J. A job that begs for a direct copy/paste requires more, to me.
>
> I realize that the new direct definition feature simplifies this somewhat,
> but I have been looking into this task without such. I don't think the
> reference card would demonstrate the complexity of the (simple?) task I
> suggest below. Do you agree with my observations?
>
> 3+0".every LF cut (0 : 0)
> 2 -7 3
> 4 0 4
> )
> 5 _4 6
> 7 3 7
>
> On Wed, Aug 10, 2022 at 3:40 AM Jared <[email protected]> wrote:
>
> > I use the old ref card printed and laminated on my desk.
> >
> > My use case; J is my desktop calculator but I want to learn to use it for
> > more. As problems and queries come in, I will solve them with Excel or
> > Datagrip, but a repeat calculation I will wonder how to do it in J.
> >
> > For instance I used the card, to expand my knowledge a couple weeks ago,
> > where I need to sum two columns, but can only enter a pair of data at a
> > time. The refcard was more helpful than Nuvoc for me to see an example of a
> > function that is doing close to what I need, as it had the functions in
> > groups.
> >
> > Thank you,
> > Jared Nicholson
> >
> > --
> (B=) <-----my sig
> Brian Schott
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm