why is the notation for list and array indexing different?

View: New views
5 Messages — Rating Filter:   Alert me  

why is the notation for list and array indexing different?

by terrence.brannon :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


What motivated distinct notation for list indexing (MyList !! i) versus array indexing (MArray.[2] )?

You would think that it would simply be overloaded.

--
Terrence Brannon - SID W049945
1111 Polaris Pkwy, OH1-1141, Columbus, OH 43240
818-359-0893 (cell)
614-213-3426 (fax)




This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries and affiliates. This transmission may contain information that is privileged, confidential, legally privileged, and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. Although this transmission and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMorgan Chase & Co., its subsidiaries and affiliates, as applicable, for any loss or damage arising in any way from its use. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to UK legal entities.


_______________________________________________
clean-list mailing list
clean-list@...
http://mailman.science.ru.nl/mailman/listinfo/clean-list

Re: why is the notation for list and array indexing different?

by terrence.brannon :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Of course, the same question applies to why drawing from a List uses <- but drawing from an Array uses <-:

It does not seem necessary to have syntactic distnction.

--
Terrence Brannon - SID W049945
1111 Polaris Pkwy, OH1-1141, Columbus, OH 43240
818-359-0893 (cell)
614-213-3426 (fax)






terrence.x.brannon@...
Sent by: clean-list-bounces@...

08/22/2008 02:50 PM

To
clean-list@...
cc
Subject
[clean-list] why is the notation for list and array indexing        different?






What motivated distinct notation for list indexing (MyList !! i) versus array indexing (MArray.[2] )?


You would think that it would simply be overloaded.


--
Terrence Brannon - SID W049945
1111 Polaris Pkwy, OH1-1141, Columbus, OH 43240
818-359-0893 (cell)
614-213-3426 (fax)



This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries and affiliates. This transmission may contain information that is privileged, confidential, legally privileged, and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. Although this transmission and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMorgan Chase & Co., its subsidiaries and affiliates, as applicable, for any loss or damage arising in any way from its use. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to UK legal entities. _______________________________________________
clean-list mailing list
clean-list@...
http://mailman.science.ru.nl/mailman/listinfo/clean-list


This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries and affiliates. This transmission may contain information that is privileged, confidential, legally privileged, and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. Although this transmission and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMorgan Chase & Co., its subsidiaries and affiliates, as applicable, for any loss or damage arising in any way from its use. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to UK legal entities.


_______________________________________________
clean-list mailing list
clean-list@...
http://mailman.science.ru.nl/mailman/listinfo/clean-list

List index notation used on unboxed arrays in Language Report?

by terrence.brannon :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On p.24 of Language Report we see this:

 
StripNewline string
  | string !! last<>’\n’ = string
 
but !! is used to index lists and a String is an unboxed array.

--
Terrence Brannon - SID W049945
1111 Polaris Pkwy, OH1-1141, Columbus, OH 43240
818-359-0893 (cell)
614-213-3426 (fax)




This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries and affiliates. This transmission may contain information that is privileged, confidential, legally privileged, and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. Although this transmission and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMorgan Chase & Co., its subsidiaries and affiliates, as applicable, for any loss or damage arising in any way from its use. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to UK legal entities.


_______________________________________________
clean-list mailing list
clean-list@...
http://mailman.science.ru.nl/mailman/listinfo/clean-list

Re: why is the notation for list and array indexing different?

by Pieter Koopman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Terrence,

terrence.x.brannon@... wrote:
>
> What motivated distinct notation for list indexing (MyList !! i)
> versus array indexing (MArray.[2] )?
An Array is an instance of a 2 parameter class (class Array .a e where
..) while lists are a plain polymorphic data  type. I think we cannot
convince the type checker that it is a good idea to use the same
operator in both situation.

Best,

Pieter Koopman
> You would think that it would simply be overloaded.
>
> --
> Terrence Brannon - SID W049945
> 1111 Polaris Pkwy, OH1-1141, Columbus, OH 43240
> 818-359-0893 (cell)
> 614-213-3426 (fax)
_______________________________________________
clean-list mailing list
clean-list@...
http://mailman.science.ru.nl/mailman/listinfo/clean-list

Re: List index notation used on unboxed arrays in Language Report?

by Pieter Koopman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

terrence.x.brannon@... wrote:
>
> On p.24 of Language Report we see this:
>
>  
> StripNewline string
>   | string !! last<>’\n’ = string
>  
> but !! is used to index lists and a String is an unboxed array.
That is correct. You spotted an error. We will update this.

Best,

Pieter Koopman

> --
> Terrence Brannon - SID W049945
> 1111 Polaris Pkwy, OH1-1141, Columbus, OH 43240
> 818-359-0893 (cell)
> 614-213-3426 (fax)
>
>
>
> ------------------------------------------------------------------------
>
> This communication is for informational purposes only. It is not
> intended as an offer or solicitation for the purchase or sale of any
> financial instrument or as an official confirmation of any
> transaction. All market prices, data and other information are not
> warranted as to completeness or accuracy and are subject to change
> without notice. Any comments or statements made herein do not
> necessarily reflect those of JPMorgan Chase & Co., its subsidiaries
> and affiliates. This transmission may contain information that is
> privileged, confidential, legally privileged, and/or exempt from
> disclosure under applicable law. If you are not the intended
> recipient, you are hereby notified that any disclosure, copying,
> distribution, or use of the information contained herein (including
> any reliance thereon) is STRICTLY PROHIBITED. Although this
> transmission and any attachments are believed to be free of any virus
> or other defect that might affect any computer system into which it is
> received and opened, it is the responsibility of the recipient to
> ensure that it is virus free and no responsibility is accepted by
> JPMorgan Chase & Co., its subsidiaries and affiliates, as applicable,
> for any loss or damage arising in any way from its use. If you
> received this transmission in error, please immediately contact the
> sender and destroy the material in its entirety, whether in electronic
> or hard copy format. Thank you. Please refer to
> http://www.jpmorgan.com/pages/disclosures for disclosures relating to
> UK legal entities.
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> clean-list mailing list
> clean-list@...
> http://mailman.science.ru.nl/mailman/listinfo/clean-list
>  
_______________________________________________
clean-list mailing list
clean-list@...
http://mailman.science.ru.nl/mailman/listinfo/clean-list
LightInTheBox - Buy quality products at wholesale price!