Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,11 @@
|
|||
m := (FillInTheBlankMorph request: 'Number of rows?') asNumber.
|
||||
n := (FillInTheBlankMorph request: 'Number of columns?') asNumber.
|
||||
aMatrix := Matrix rows: m columns: n.
|
||||
aMatrix
|
||||
at: (aMatrix rowCount // 2)
|
||||
at: (aMatrix columnCount // 2)
|
||||
put: 3.4.
|
||||
e := aMatrix
|
||||
at: (aMatrix rowCount // 2)
|
||||
at: (aMatrix columnCount // 2).
|
||||
Transcript show: 'Entry is', e printString.
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
|num1 num2 arr|
|
||||
num1 := stdin nextLine asInteger.
|
||||
num2 := stdin nextLine asInteger.
|
||||
|
||||
arr := MultidimensionalArray new: { num1. num2 }.
|
||||
|
||||
1 to: num1 do: [ :i |
|
||||
1 to: num2 do: [ :j |
|
||||
arr at: { i. j } put: (i*j)
|
||||
]
|
||||
].
|
||||
|
||||
1 to: num1 do: [ :i |
|
||||
1 to: num2 do: [ :j |
|
||||
(arr at: {i. j}) displayNl
|
||||
]
|
||||
].
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
Object subclass: BidimensionalArray [
|
||||
|biArr|
|
||||
<comment: 'bidim array'>
|
||||
].
|
||||
BidimensionalArray class extend [
|
||||
new: biDim [ |r|
|
||||
r := super new.
|
||||
r init: biDim.
|
||||
^ r
|
||||
]
|
||||
].
|
||||
BidimensionalArray extend [
|
||||
init: biDim [
|
||||
biArr := Array new: (biDim at: 1).
|
||||
1 to: (biDim at: 1) do: [ :i |
|
||||
biArr at: i put: (Array new: (biDim at: 2))
|
||||
].
|
||||
^ self
|
||||
]
|
||||
at: biDim [
|
||||
^ (biArr at: (biDim at: 1)) at: (biDim at: 2)
|
||||
]
|
||||
at: biDim put: val [
|
||||
^ (biArr at: (biDim at: 1)) at: (biDim at: 2) put: val
|
||||
]
|
||||
].
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
|num1 num2 pseudoArr|
|
||||
num1 := stdin nextLine asInteger.
|
||||
num2 := stdin nextLine asInteger.
|
||||
|
||||
"we can 'suggest' an initial value for the number
|
||||
of ''slot'' the table can hold; anyway, if we use
|
||||
more than these, the table automatically grows"
|
||||
pseudoArr := LookupTable new: (num1 * num2).
|
||||
|
||||
1 to: num1 do: [ :i |
|
||||
1 to: num2 do: [ :j |
|
||||
pseudoArr at: {i. j} put: (i * j).
|
||||
]
|
||||
].
|
||||
|
||||
1 to: num1 do: [ :i |
|
||||
1 to: num2 do: [ :j |
|
||||
(pseudoArr at: {i. j}) displayNl.
|
||||
]
|
||||
].
|
||||
Loading…
Add table
Add a link
Reference in a new issue