[Jprogramming] Dyads and identity function
Pascal Jasmin
godspiral2000 at yahoo.ca
Mon Oct 23 04:51:37 HKT 2006
a useful counterexample where 0 n $ y or i. 0 n produces a result that is conveniently different than i.0 0 would substantially contribute to the impression that the costs of eliminating that behaviour are high. Especially, if there is no natural way of rewritting that counterexample.
I expect some performance costs in treating dyads "naturally" wrt identity functions.
I cannot measure the costs, and will stick to detailing benefits. There would seem to be performance benefits from having values that are 'nil entity with rank k' (i.0 , i. 0 0, i.0 0 0 etc...) by not having to hold more complex data than necessary in memory, and not needing user code to guard against irrelevant details.
I couldn't understand the argument regarding {. and how it might be used, sorry.
but this made my head explode, (first answer is a fill, I presume, but still don't understand behaviour of last 2)
{. i.0
0
$ $ {. i.0
0
(i.0) -: $ {. i.0
1
I guess this example could be addressed:
+/"1 |: 0 6 $ i.6
0 0 0 0 0 0
A shape of m 0 k1 k2 k3 could be converted to m 0 0 0 0, because as shown above, shapes of 0 k can easily be transposed into k 0. There's still no 'real data' inside. The only information is the shape.
----- Original Message ----
From: "Miller, Raul D" <rdmiller at usatoday.com>
To: Programming forum <programming at jsoftware.com>; Programming forum <programming at jsoftware.com>
Sent: Sunday, October 22, 2006 3:09:30 PM
Subject: RE: [Jprogramming] Dyads and identity function
Pascal Jasmin wrotete:
> I would suggest that the distinction between (0 n $ y1) and
> 0 0 $ y1 never provides any value and always "gets in the way".
If you are only building up lists using , that might be true.
However, if you are manipulating collections using other operations,
such as {. then this is not at all true.
For what it's worth, here's an identity adjective:
ident=:1 :'a:1 :(u b.1)'
For example:
+ident 99
0
+ident i. 9 9
0 0 0 0 0 0 0 0 0
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
More information about the Programming
mailing list