Some questions on Slate syntax

Bill Sun billksun at yahoo.com
Sun Mar 27 18:25:43 PST 2005


> Yes, I agree that spatial metaphors are most appropriate for arrays
> and indexing. Think of the index as corresponding to a distance from
> the start of the sequence, and as pointing to the left [*] of the
> item
> being indexed:
> 
>    0   1   2   3   4
>    +---+---+---+---+
>    |   |   |XXX|   |
>    +---+---+---+---+
> 
>    <---2--->
> 
> 
> For intervals, use the half-open convention and think of the bounds
> as being the left and right sides of the bounded interval, e.g. for
> the interval [1,3):
> 
>    0   1   2   3   4
>    +---+---+---+---+
>    |   |XXX|XXX|   |
>    +---+---+---+---+
> 
>    <-1->
>    <-----3----->

Thanks for the nice illustrations!  I'm a very visual person, so this
really helps.  

> Natural numbers start at 0.
 
My mistake, I should of just said the smallest positive integer number.

>Also it's possible to eliminate almost all of the performance
>difference in the language implementation by subtracting one element
>from the base pointer for each array.

Do you mean by having the base pointer point to the second element
rather than the first?  If so, does that mean there will always be one
wasted element? 

At the risk of being looked down upon, I'll admit that I do NOT have a
degree in Computer Science, I self-educated myself in programming
beyond the introductory courses that I took back in college.  Or shall
I say ALL of the computer science class that my college offer, as it
doesn't have a CS department.  That said, I hope I am not wasting your
times for my intellectual thirst.  It always feels good to have your
ego humbled and your mind opened up, by knowledge.

Ok, now that I understand 0-based arrays differ in the way the indexing
metaphor is used and not just the based index number, I think I'm
satisfied with the answers reguarding 0-based arrays.  But I'm still
thirsty :) What about precedence in arithmetic messages?  I found the
following footnote in the language reference manual reguarding
aritmetic precedence:

"This removes a source of grammatical complexity in a language where
anyone can add new binary selectors or implementations. It is our
policy that conventional mathematical notation and visual convenience
belong in user interface libraries."

Cound someone elaborate on that?  Some examples will be helpful.

-Bill Sun


		
__________________________________ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/ 




More information about the Slate mailing list