Re: [Pharo-dev] About Matrix API access

2015-02-17 Thread Richard Sargent
stepharo wrote
 ...
 | matrix23 |
 matrix23 := Matrix rows: 3 columns: 2.
 matrix23 at: 1 at: 1 put: 11.

What? #at:at:put:? That *will* cause errors. The ats are effectively
anonymous keywords.

I hope the API can still be changed. e.g. #atRow:column:put: and possibly
also #atColumn:row:put:.



Thaks,
Richard



--
View this message in context: 
http://forum.world.st/About-Matrix-API-access-tp4805746p4806237.html
Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.



[Pharo-dev] About Matrix API access

2015-02-15 Thread stepharo

Hi


I'm wondering why

| matrix23 |
matrix23 := Matrix rows: 3 columns: 2.
matrix23 at: 1 at: 1 put: 11.
matrix23 at: 1 at: 2 put: 12.
matrix23 at: 1 at: 3 put: 13.
matrix23 at: 2 at: 1 put: 21.
matrix23 at: 2 at: 2 put: 22.
matrix23 at: 2 at: 3 put: 23.

is not equivalent to

| matrix23 |
matrix23 := Matrix rows: 3 columns: 2.
matrix23 atColumn: 1 atRow: 1 put: 11.
matrix23 atColumn: 1 atRow: 2 put: 12.
matrix23 atColumn: 1 atRow: 3 put: 13.
matrix23 atColumn: 2 atRow: 1 put: 21.
matrix23 atColumn: 2 atRow:  2 put: 22.
 ^ matrix23 atColumn: 2 atRow: 3 put: 23

I always thought that math notation was x,y (row,colum)
How is it done in other languages?
I checked the implementation so I know but why this choice in the API.




Re: [Pharo-dev] About Matrix API access

2015-02-15 Thread stepharo

this is correct

| matrix23 |
matrix23 := Matrix rows: 3 columns: 2.
matrix23 at: 1 at: 1 put: 11.

is equivalent to

| matrix23 |
matrix23 := Matrix rows: 3 columns: 2.
matrix23 at: 1 atRow: 1 putColumn: 11.

In ruby [i,j] Returns element (i,j) of the matrix. That is: row i, column j.

This is strange that we cannot map i to x and j to y position and that
i is in fact mapped to y


Hi


I'm wondering why

| matrix23 |
matrix23 := Matrix rows: 3 columns: 2.
matrix23 at: 1 at: 1 put: 11.
matrix23 at: 1 at: 2 put: 12.
matrix23 at: 1 at: 3 put: 13.
matrix23 at: 2 at: 1 put: 21.
matrix23 at: 2 at: 2 put: 22.
matrix23 at: 2 at: 3 put: 23.

is not equivalent to

| matrix23 |
matrix23 := Matrix rows: 3 columns: 2.
matrix23 atColumn: 1 atRow: 1 put: 11.
matrix23 atColumn: 1 atRow: 2 put: 12.
matrix23 atColumn: 1 atRow: 3 put: 13.
matrix23 atColumn: 2 atRow: 1 put: 21.
matrix23 atColumn: 2 atRow:  2 put: 22.
 ^ matrix23 atColumn: 2 atRow: 3 put: 23

I always thought that math notation was x,y (row,colum)
How is it done in other languages?
I checked the implementation so I know but why this choice in the API.









Re: [Pharo-dev] About Matrix API access

2015-02-15 Thread stepharo


Le 15/2/15 11:23, Sven Van Caekenberghe a écrit :

http://en.wikipedia.org/wiki/Matrix_(mathematics) ?

yes
Since i, j, are the nearly the same for me, as well as row and columns
I always got to be really concentrated during my math exam :)

Stef



On 15 Feb 2015, at 11:13, stepharo steph...@free.fr wrote:

Hi


I'm wondering why

| matrix23 |
matrix23 := Matrix rows: 3 columns: 2.
matrix23 at: 1 at: 1 put: 11.
matrix23 at: 1 at: 2 put: 12.
matrix23 at: 1 at: 3 put: 13.
matrix23 at: 2 at: 1 put: 21.
matrix23 at: 2 at: 2 put: 22.
matrix23 at: 2 at: 3 put: 23.

is not equivalent to

| matrix23 |
matrix23 := Matrix rows: 3 columns: 2.
matrix23 atColumn: 1 atRow: 1 put: 11.
matrix23 atColumn: 1 atRow: 2 put: 12.
matrix23 atColumn: 1 atRow: 3 put: 13.
matrix23 atColumn: 2 atRow: 1 put: 21.
matrix23 atColumn: 2 atRow:  2 put: 22.
^ matrix23 atColumn: 2 atRow: 3 put: 23

I always thought that math notation was x,y (row,colum)
How is it done in other languages?
I checked the implementation so I know but why this choice in the API.










Re: [Pharo-dev] About Matrix API access

2015-02-15 Thread Sven Van Caekenberghe
http://en.wikipedia.org/wiki/Matrix_(mathematics) ?

 On 15 Feb 2015, at 11:13, stepharo steph...@free.fr wrote:
 
 Hi
 
 
 I'm wondering why
 
 | matrix23 |
 matrix23 := Matrix rows: 3 columns: 2.
 matrix23 at: 1 at: 1 put: 11.
 matrix23 at: 1 at: 2 put: 12.
 matrix23 at: 1 at: 3 put: 13.
 matrix23 at: 2 at: 1 put: 21.
 matrix23 at: 2 at: 2 put: 22.
 matrix23 at: 2 at: 3 put: 23.
 
 is not equivalent to
 
 | matrix23 |
 matrix23 := Matrix rows: 3 columns: 2.
 matrix23 atColumn: 1 atRow: 1 put: 11.
 matrix23 atColumn: 1 atRow: 2 put: 12.
 matrix23 atColumn: 1 atRow: 3 put: 13.
 matrix23 atColumn: 2 atRow: 1 put: 21.
 matrix23 atColumn: 2 atRow:  2 put: 22.
 ^ matrix23 atColumn: 2 atRow: 3 put: 23
 
 I always thought that math notation was x,y (row,colum)
 How is it done in other languages?
 I checked the implementation so I know but why this choice in the API.