a workaround solution to making v0`v1`v2} monadic append is to append ~ to }.
For example a function that fills in a default value:
dfltT =: 1 : '(<@)~(`(m"_))(`[)}~(^:('''' -: m {:: ]))'
(0 +:@:{:: ]) 1 dfltT
<@(0 +:@:({::) ])~`(1"_)`[}~^:('' -: 1 {:: ])
(0 +:@:{:: ]) 1 dfltT 2 ; ''
┌─┬─┐
│2│4│
└─┴─┘
(0 +:@:{:: ]) 1 dfltT 2 ; 3
┌─┬─┐
│2│3│
└─┴─┘
the v0 function can/must be dyadic, and accesses full x and y in the normal
locations ([]).
On Monday, September 17, 2018, 11:36:17 a.m. EDT, 'Pascal Jasmin' via
Programming <[email protected]> wrote:
Not that I've seen the implementation code, but the thought is that none of the
optimizations would be affected if at a high level
v0`v1`v2} is always amend (regardless of valence)
v0`v1} is always composite item.
My proposal was/is to allow the composite item version to be ambivalent (for
definitional simplicity and convenience), but its not what I care about. Its
just the first version that has no current use monadically.
The pattern where monadic amend is useful is when y is a boxed record structure
where data in one field can help update another field. Or simplicity when the
update value is a function of the data.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm