Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,6 +1,27 @@
|
|||
point: #[
|
||||
x: 10
|
||||
y: 20
|
||||
define :Point [
|
||||
init: constructor [x :integer, y :integer]
|
||||
|
||||
distance: method [other][
|
||||
sqrt (\x - other\x)^2 + (\y - other\y)^2
|
||||
]
|
||||
|
||||
string: method [][
|
||||
"Point(" ++ (to :string \x) ++ ","
|
||||
++ (to :string \y) ++ ")"
|
||||
]
|
||||
]
|
||||
|
||||
print point
|
||||
pt: to :Point [6 7]!
|
||||
print ["point A's x coordinate is:" pt\x]
|
||||
|
||||
; set a field
|
||||
pt\y: 3
|
||||
|
||||
; stringify using custom magic method
|
||||
print ["point A:" pt]
|
||||
|
||||
pt2: to :Point [2 5]!
|
||||
print ["point B:" pt2]
|
||||
|
||||
|
||||
print ["Distance between points:" pt\distance pt2]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue