Yes, }:: is reserved for Emend which will do what you want. Someday.
Maybe erelong.
In the meantime, use applyintree from
http://code.jsoftware.com/wiki/Vocabulary/AmendingBoxedStructures
a =: 1 2 3 ; <4 ; < 5 6; <7 8
a
+-----+-------------+
|1 2 3|+-+---------+|
| ||4|+---+---+||
| || ||5 6|7 8|||
| || |+---+---+||
| |+-+---------+|
+-----+-------------+
(<123) [ applyintree (1;1;0) a
+-----+---------------+
|1 2 3|+-+-----------+|
| ||4|+-----+---+||
| || ||+---+|7 8|||
| || |||123|| |||
| || ||+---+| |||
| || |+-----+---+||
| |+-+-----------+|
+-----+---------------+
Henry Rich
On 3/14/2018 10:54 PM, [email protected] wrote:
There's a question I'm tracking on Stack Overflow that I'm trying to solve:
https://stackoverflow.com/questions/49288689/how-to-amend-data-in-a-box-j-pr
ogramming
Given a multi-level box:
a =: 1 2 3 ; <4 ; < 5 6; <7 8
How to you amend something given an address multiple levels into the box,
e.g. the <5 6 part? I've tried some combination of S: and {:: and } however
I can't seem to crack it. I might have expected this to work:
(<123) (1;1;0)} a
However, in this example, the (1;1;0) replaces item 1 and 0, treating the
1;1;0 as the list of elements to amend, as opposed to the array index to be
amended, as is the case with (1;1;0) {:: a
Does this mean that J needs a new amend operator, something akin to:
(<123) (1;1;0) }:: a
?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
---
This email has been checked for viruses by AVG.
http://www.avg.com
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm