I'd like to propose as a part of stdlib:

HEAD=:1 :0
  assert 0=nc<'m'
  [:echo m{.1 1}._1 _1}.":@<
)

Why?

Well, by default, git merge conflicts look like this:

<<<<<<< HEAD
  NB. before
=======
  NB. after
>>>>>>> branchname

And, quite often, that is syntactically valid J.

But with only a tiny amount of work, we can make that be invalid.

Meanwhile, another issue is that sometimes 9!:37 is set so that you
can't see enough of the result.

So this would be a slightly useful gain on two fronts, for almost no effort:

It would make a git merge conflict so that it would typically force an
error, somewhere in the code:

   <<<<<<< HEAD
|assertion failure: assert
|       assert 0=nc<'m'

It would also give you a way of displaying the top of a result if you
have (reasonably) set your output control to only display the bottom
of large results:

   9!:36''
0 256 0 222
   9!:37]0 256 0 2

   i.3 3
...
3 4 5
6 7 8
   2 HEAD i.3 3
0 1 2
3 4 5


That said, if you wanted to get fancy, you could do a more elaborate
version where verb left arguments are allowed but < is specifically
forbidden (because of git).

I'm sending this to beta forum rather than programming, because it's
not about the code itself but about a potential change to J.

I'm thinking the risks here are low, and the benefits are valid.

Thanks,

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to