You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following is a proposal to extend Under (&.) to allow various (any, I hope) possible combinations.
Syntax
u&.(vi`v`ul`ur) y <--> {{vi v^:_1 ul u ur}} y
x u&.(vi`v`ul`ur) y <--> x {{vi v^:_1 ul u ur}} y
where
u - verb to process transformed argument(s)
v - verb with assigned obverse to do/undo arguments transformation
vi - verb to produce a left argument for v^:_1, is [: if v^:_1 is monadic
ul - verb to produce a left argument for u, is [: if u is monadic
ur - verb to produce a right argument for u
Model
und=: 2 : 'n@.0 n@.1^:_1 n@.2 u n@.3'
Examples
Implement standard monadic &.:
%:<:*:4NB. sqrt(4^2 - 1)3.87298<:&.*:43.87298<: und ([:`*:`[:`*:) 4NB. the resulting train is ([: *:^:_1 [: <: *:)3.87298
Implement standard dyadic &.:
%: (*:3) + (*:4) NB. sqrt(3^2 + 4^2)53+&.*:453+ und ([:`*:`(*:@[)`(*:@])) 4NB. the resulting train is ([: *:^:_1 *:@[ + *:@])5
Implement standard dyadic &. with semiduals:
%:3+ (*:4) NB. sqrt(3 + 4^2)4.35893+&.(a:`*:) 44.35893+ und ([:`*:`[`(*:@])) 4NB. the resulting train is ([: *:^:_1 [ + *:@])4.3589%: (*:3) +4NB. sqrt(3^2 + 4)3.605553+&.(*:`a:) 43.605553+ und ([:`*:`(*:@[)`]) 4NB. the resulting train is ([: *:^:_1 *:@[ + ])3.60555
Implement non-standard monadic &. with dyadic inversion (say, for some J dictionary jdict):
upd=: get__jdict :. (put__jdict~)
NB. a monad to double values corresponding to keys y+: und (]`upd`[:`upd) NB. the resulting train is (] upd^:_1 [: +: upd)
Implement non-standard dyadic &. with dyadic inversion:
NB. a dyad which passes its left argument x to the left argument of v^:_1
u und ([`v`ul`ur) NB. the resulting train is ([ u^:_1 ul u ur)
Activity