jsoftware / jsource

J engine source mirror
Other
657 stars 90 forks source link

special code for tacit scalar replacement #37

Open tangentstorm opened 3 years ago

tangentstorm commented 3 years ago

I request that the idiomatic verbs m&=`(,:&n)} and m&=`(n&,:)} for scalar m and n and e.&m`(,:&n)} and e.&m`(n&,:)} for vector m and scalar n be supported by special code.

In particular, I am thinking of the special code which underlies c}x,:y for boolean c (that is, the code for explicit monadic boolean amendment).

If my proposed inverses for scalar replacement are implemented, I submit the parallel request that this special code support those inverses as well (which may just fall out naturally, as the inverses have the same (optimizable) form).

In that previous request, I showed how the = verbs can be useful. Here is an example of the utility of the e. verbs:

   e.&WHITESPACE`(,:&' ')}  'stuff and',LF,'things',TAB,'some more'
stuff and things some more
   e.&DIGITS    `(' '&,:)} 'buy 123 of item 5'
    123         5

   ;: e.&WHITESPACE`(,:&' ')}  'stuff and',LF,'things',TAB,'some more'
+-----+---+------+----+----+
|stuff|and|things|some|more|
+-----+---+------+----+----+
   0 ". e.&DIGITS    `(' '&,:)} 'buy 123 of item 5'
123 5

-- Dan Bron <2008-02-02T00:29:14Z>