Re: ? 1={}, is there really any other interpretation?
Al Getz wrote:
>
> CChris wrote:
> >
> > [Snipped]
> > >
> > > More generally, i think that sequences are always going to be just
> > > a little confusing.
> >
> > ??? I don(t think so. Only thing is, sometimes there are two possible
> > semantics
> > for a single piece of code, and the interpreter had to choose one of them,
> > even
> > when you'd rather it making the other choice, which was about as justified.
> >
> > > For example, how do you answer this question:
> > >
> > > x={{}}
> > >
> > > Is the sequence x holding anything or not?
> > >
> >
> > x has length 1, so it holds something.
> > What it holds is an empty sequence. A box which contains a box which is
> > empty
> > is not emopty itself.
> >
>
> That question was designed to get the reader to think more about
> the sequence, not to provide one or more examples of how it
> *might* be interpreted. You forced the sequence to be a box,
> when really it is not that physical. If you choose another
> type of entity for the sequence to be it might not work
> anymore. For example, can a hole in the ground hold another
> hole in the ground?
> This was mainly to show that thinking about the sequence is
> different than thinking about other things like atoms.
> I realize now though that i didnt make my intent that clear originally
> so it would make sense when talking about 1={}.
>
It still works with holes.
Let a sequence be a hole leading to a cavity. Along the circular wall of the
cavity are either atoms or other holes, or nothing at all. So {{}} is a hole at
the bottom of which another smaller hole starts. The main hole is not empty,
since there is one feature to be seen at the bottom.
> > > Then, what should be returned for this:
> > >
> > > ? 1=x
> > >
> >
> > Since x is {x[1]}, 1=x is equivalent to { 1=x[1] }, which is { 1={} }, which
> > is {{}}.
> >
> > > Then, change x:
> > >
> > > x={{{}}}
> > >
> > > Now what should ? 1=x return (or print)?
> > >
> >
> > Same approach: 1=x is {1=x[1]}, which is { 1={{}} }, which is {{{}}} using
> > the
> > previous result. Very claer and intuitive.
> >
>
> (see above)
>
> > CChris
>
> My suggestion now is that if an operation is enclosed in curly
> brackets that the operation return a sequence, otherwise
> it returns an atom.
>
> ?{x={{}}} --x becomes a sequence: {{}} displayed
>
> ?x={{}} --x becomes an integer: 0 displayed
>
> This, however, would break code unfortunately.
>
I still don't understand why not use compare() and equal() in these
indeterminate contexts, since they were included in the language for that very
purpose. What did I miss?
CChris
>
> Al
>
> E boa sorte com sua programacao Euphoria!
>
>
> My bumper sticker: "I brake for LED's"
>
|
Not Categorized, Please Help
|
|