4 id (2+2) 1 but
4 id (8%2) 0 ________________________________ From: Roger Hui <[email protected]> To: Programming forum <[email protected]> Sent: Wednesday, May 27, 2009 8:47:42 PM Subject: Re: [Jprogramming] confused about different emptiness An interesting idea. However, it still does not do what June Kim wants, which is that things that "match" (or are "equal") should be [inter]replaceable. For that to happen you'd have to say that 4 and 8%2 are not "equal". (The former is 4 bytes whereas the latter is 8 bytes.) ----- Original Message ----- From: Henry Rich <[email protected]> Date: Wednesday, May 27, 2009 17:29 Subject: Re: [Jprogramming] confused about different emptiness To: Programming forum <[email protected]> > It's 'match', not 'identically equal to'. The problem is > that you want > it to mean 'identical', but it doesn't. > > For years I have made the same argument you are making. I > have been > ignored. > > I have come to the conclusion that I was wrong. (But I > still have an > improvement to suggest below.) > > There are a number of cases where the interpreter treats all > empty > operands as identical. It is a good thing to have a > primitive that can > calculate that way. > > The biggest defect in having only -: is when the operands are > boxed, and > you need to test for exact identity all through the boxing > levels. That > is a pain. > > > Suggestion: > > Why not define dyad ~. to mean 'identicalto', in rank, shape, > value, AND > TYPE (numeric/literal/symbol). That would solve the > problem of > detecting deep equality, and also plug the gap in the language, > where > currently there is no primitive to tell whether two nouns are > identical. > Henry Rich > > > > June Kim wrote: > > I like weak-typing and see its advantages. > > > > Regardless of that, when two things match each other, it seems > natural> they are replaceable. But in this case, they are not > and they behave > > differently(the results do not match) on "take". The > programmer could > > make some mistakes from this. > > > > > > On Wed, May 27, 2009 at 10:23 PM, Devon McCormick > <[email protected]> wrote: > >> Mr. Kim - > >> > >> I disagree. A language like J benefits tremendously > from weak-typing and > >> the equivalence of empty arrays is an outcome of this, just > like the > >> numerical equivalence of other objects which differ > internally, e.g. > >> > >> datatype -.1 > >> boolean > >> datatype 1.1-1.1 > >> floating > >> (-.1)-:1.1-1.1 > >> 1 > >> > >> Obviously, we have a simple way to get at "internal" > information, like > >> type. However, it's much more useful to hide internal > differences like that > >> for comparison purposes. In my view, the preference of > many computer > >> scientists for strong-typing is misguided because, as a > practical matter, it > >> complicates things unnecessarily. > >> > >> Regards, > >> > >> Devon > >> > >> On Wed, May 27, 2009 at 4:25 AM, June Kim > <[email protected]> wrote: > >> > >>> '' ;&datatype I.0 > >>> +-------+-------+ > >>> |literal|integer| > >>> +-------+-------+ > >>> > >>> It seems like there are different emptiness for every > datatype but > >>> they all match same. I think it's more natural they don't match. > >>> > >>> On Wed, May 27, 2009 at 5:08 PM, June Kim > <[email protected]> wrote: > >>>> ''-: I. 0 > >>>> 1 > >>>> {. '' > >>>> > >>>> {. I.0 > >>>> 0 > >>>> > >>>> Shouldn't '' -:&{. I.0 be true, given ''-:I.0? ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
