Greg> 10 Ts 'name=: }:name' Roger> Thanks for the tip. While you're at it, can we have
name =: , name and name =: x ($,) name NB. Assuming x <:&:(*:/) $ name I've wanted this fairly often; I wish I'd piped up every time it'd occured to me. One example I remember is from http://www.jsoftware.com/pipermail/beta/2006-April/000953.html : Dan> However, unlike y =. c } x ,: y , the phrase y =. , y is not Dan> optimized, so we're likely to lose our efficiency gains to Dan> a large memcopy. On a related note, it would be nice if we had JSoftware supported method of detecting whether a name is mapped. For example, I notice JSoftware included in the standard library the version of charsub I submitted to the thread I just quoted. However, the library version differs from my submission in that the final assignment is elided. This is less efficient, and I presume it was done to avoid changing a mapped noun, in the case that one be provided as input. (I personally think if you're passing a mapped noun as an argument, you want it to be changed, but that's a matter of policy.) If we had a monadic verb isMapped we could preserve the efficieny of the nominal case while maintaining safety in the obscure (mapped argument) case. To wit: charsub =: 4 : 0 'f t'=. |: _2 ]\ x l=. f i."1 0 y x=. l { t,'?' c=. l = #f if. -. isMapped y do. y =. c } x ,: y else. c } x ,: y end. ) Is it possible to get a fast, JSoftware approved definition of isMapped? Perhaps a 15!: family foriegn? -Dan ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
