:=
)^
)| <_1> <_2> |
)#( _1 _2 )
)[ : <> | < > ]
)#('' '' '') size
Array
class is sent a size
message, whose processing method will return the size of the message recipient. In this case, the recipient of the message is #('' '' '')
, and the message processing method size
returns the value 3.10 - 5
-
sent to the instance of the SmallInteger class - 10
-
(minus), with one argument - the SmallInteger class instance - 5
. Message processing method -
(minus) returns the difference between the recipient (10) and the argument (5). It should be noted that the recipient of the message may be the result of performing any operation. So in expression 6 - 2 * 3
recipient of the message *
will be the result of operation 6 - 2
and in response to the message *
returns 12, not 0, as one would assume. In order to change the order of calculations, brackets should be used, which will make it possible to treat the expression inside the brackets as an argument to the message in front of it. Messages of this type must necessarily consist of one or two special characters (+, =,! =, //, \\, etc.).Transcript show: 'Hello!'
CwTextPrompter prompt: ' ?' answer: '' title: '...'
CwTextPrompter prompt: ' ?' answer: '' title: '...'
show
keyword, followed by a string - an argument object. The second example message consists of three keywords: prompt: answer: title:
set of keywords in a certain order is a message. It is recommended to place the words in the message so that when the message is written along with the argument objects, the expression reads like a sentence in natural language.*
which multiplies the receiver matrix by the argument matrix:* rcMatrix
" "
" "
| r |
" r new:with: RCMatrix"
r := RCMatrix new: (self rowsCount) with: (rcMatrix columnsCount).
" "
1 to: (self rowsCount) do:
[:i |
1 to: (rcMatrix columnsCount) do:
[:j |
r at: i at: j put: 0.
].
].
""
1 to: (self rowsCount) do:
[:i |
1 to: (rcMatrix columnsCount) do:
[:j |
1 to: (rcMatrix rowsCount) do:
[:k |
r at: i at: j put:
((r at: i at: j) +
((self at: i at: k) * (rcMatrix at: k at: j))).
].
].
].
" "
^r.
* This source code was highlighted with Source Code Highlighter .
Source: https://habr.com/ru/post/72007/
All Articles