Re: subscripts

new topic     » goto parent     » topic index » view thread      » older message » newer message

> I meant that you could generalize the current notion
> of what a sequence is, and turn it into a kind of
> associative array, where any Euphoria object could
> be associated with any Euphoria object.
> The interpreter would maintain a list like:
>
> sequence a:
>
> subscript         value
>
> 1                       0
> 2                       {0,0,{9},1}
> 3                       {}
> "Lewis"            99
> "Townsend"     {1, 2, 3}
>
> When you read a subscript, the interpreter would
> find that subscript in the first column and return the
> associated value in the second column.
> Similarly, you could overwrite a subscripted value with
> a[1] = 10
> or,
> a["Townsend"] = {1,2,4}
> I guess the values could also be generalized sequences
> so you might see code like:
> a["Rob"]["Craig"] = 9.9
> i.e. a subscript could be any Euphoria object, but it
> only does one level of subscripting. Perl "hashes"
> are a primitive version of what I've described here.

you mean like a structure? it would be very useful.
then you could know where value in sequence is
now you must remember numbers, and look at comments each time when you want
to acces sequence members
then you would have logical names for structure (=sequence) member

now:
s[1]="name"
s[2]="surname"

then:
s.name="name"
s.surname="surname"

like in C!

i am writing preprocessor currently (slow progressing cause of school shit)
which will support structures as first thing, then i will add some more
features
it will be my very own language!

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu