## [squeak-dev] The Trunk: Help-Squeak-TerseGuide-tpr.9.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Jun 1 01:30:10 UTC 2018

```tim Rowledge uploaded a new version of Help-Squeak-TerseGuide to project The Trunk:
http://source.squeak.org/trunk/Help-Squeak-TerseGuide-tpr.9.mcz

==================== Summary ====================

Name: Help-Squeak-TerseGuide-tpr.9
Author: tpr
Time: 31 May 2018, 6:29:55.720391 pm
UUID: 7c39bd47-406b-4b82-a068-97f840b1af2d
Ancestors: Help-Squeak-TerseGuide-tpr.8

Update some more help related methods

=============== Diff against Help-Squeak-TerseGuide-tpr.8 ===============

Item was changed:
----- Method: TerseGuideHelp class>>iterationStatement (in category 'pages') -----
iterationStatement
+ 	"This method was automatically generated. Edit it using:"
+ 	"TerseGuideHelp edit: #iterationStatement"
-
^HelpTopic
title: 'Iteration Statement'
contents:

'"************************************************************************
* Iteration statements:																*
************************************************************************"
| x y |
x := 4. y := 1.
[x > 0] whileTrue: [x := x - 1. y := y * 2].		"while true loop"
[x >= 4] whileFalse: [x := x + 1. y := y * 2].	"while false loop"
x timesRepeat: [y := y * 2].					"times repear loop (i := 1 to x)"
1 to: x do: [:a | y := y * 2].					"for loop"
1 to: x by: 2 do: [:a | y := y / 2].				"for loop with specified increment"
#(5 4 3) do: [:a | x := x + a].					"iterate over array elements"

'!

Item was changed:
----- Method: TerseGuideHelp class>>metaclass (in category 'pages') -----
metaclass
+ 	"This method was automatically generated. Edit it using:"
+ 	"TerseGuideHelp edit: #metaclass"
-
^HelpTopic
title: 'Class / Metaclass'
contents:

'"************************************************************************
* class/meta-class:																	*
************************************************************************"
| b x |
x := String name.						"class name"
x := String category.					"organization category"
x := String comment.					"class comment"
x := String kindOfSubclass.				"subclass type - subclass: variableSubclass, etc"
x := String definition.					"class definition"
x := String instVarNames.				"immediate instance variable names"
x := String allInstVarNames.				"accumulated instance variable names"
x := String classVarNames.				"immediate class variable names"
x := String allClassVarNames.			"accumulated class variable names"
x := String sharedPools.					"immediate dictionaries used as shared pools"
x := String allSharedPools.				"accumulated dictionaries used as shared pools"
x := String selectors.					"message selectors for class"
x := String sourceCodeAt: #indexOf:.	"source code for specified method"
x := String allInstances.					"collection of all instances of class"
x := String superclass.					"immediate superclass"
x := String allSuperclasses.				"accumulated superclasses"
x := String withAllSuperclasses.			"receiver class and accumulated superclasses"
x := String subclasses.					"immediate subclasses"
x := String allSubclasses.				"accumulated subclasses"
x := String withAllSubclasses.			"receiver class and accumulated subclasses"
b := String instSize.						"number of named instance variables"
b := String isFixed.						"true if no indexed instance variables"
b := String isVariable.					"true if has indexed instance variables"
b := String isPointers.					"true if index instance vars contain objects"
b := String isBits.						"true if index instance vars contain bytes/words"
b := String isBytes.						"true if index instance vars contain bytes"
b := String isWords.						"true if index instance vars contain words"
Object withAllSubclasses size.			"get total number of class entries"

'!

Item was changed:
----- Method: TerseGuideHelp class>>methodCall (in category 'pages') -----
methodCall
+ 	"This method was automatically generated. Edit it using:"
+ 	"TerseGuideHelp edit: #methodCall"
-
^HelpTopic
title: 'Method Call'
contents:

'"************************************************************************
* Method calls:																		*
*    - unary methods are messages with no arguments								*
*    - binary methods																*
*    - keyword methods are messages with selectors including colons				*
*																					*
* standard categories/protocols:													*
*    - initialize-release    (methods called for new instance)							*
*    - accessing             (get/set methods)											*
*    - testing               (boolean tests - is)											*
*    - comparing             (boolean tests with parameter							*
*    - displaying            (gui related methods)										*
*    - printing              (methods for printing)										*
*    - private               (methods private to class)									*
*    - instance-creation     (class methods for creating instance)					*
************************************************************************"
| x |
x := 2 sqrt.									"unary message"
x := 2 raisedTo: 10.							"keyword message"
x := 194 * 9.								"binary message"
Transcript show: (194 * 9) printString; cr.	"combination (chaining)"
x := 2 perform: #sqrt.						"indirect method invocation"
show: ''hello '';
show: ''world'';
cr.
x := 3 + 2; * 100.							"result=300. Sends message to same receiver (3)"

'!

Item was changed:
----- Method: TerseGuideHelp class>>misc (in category 'pages') -----
misc
+ 	"This method was automatically generated. Edit it using:"
+ 	"TerseGuideHelp edit: #misc"
-
^HelpTopic
title: 'Miscellaneous'
contents:

'"************************************************************************
* Misc.																				*
************************************************************************"
| x |
"Smalltalk condenseChanges."					"compress the change file"
x := FillInTheBlank request: ''Prompt Me''.			"prompt user for input"
x := UIManager default request: ''Prompt Me''.	"prompt user for input using a flexible UI dispatcher"
Utilities openCommandKeyHelp
'!

Item was changed:
----- Method: TerseGuideHelp class>>orderedCollection (in category 'pages') -----
orderedCollection
+ 	"This method was automatically generated. Edit it using:"
+ 	"TerseGuideHelp edit: #orderedCollection"
-
^HelpTopic
title: 'Ordered Collection'
contents:

'"************************************************************************
* OrderedCollection: acts like an expandable array								*
************************************************************************"
| b x y sum max |
x := OrderedCollection with: 4 with: 3 with: 2 with: 1.	"create collection with up to 4 elements"
x := OrderedCollection new.					"allocate collection"
y := x removeFirst.								"remove first element in collection"
y := x removeLast.								"remove last element in collection"
y := x addAll: #(7 8 9).							"add multiple elements to collection"
y := x removeAll: #(7 8 9).						"remove multiple elements from collection"
x at: 2 put: 3.									"set element at index"
y := x remove: 5 ifAbsent: [].					"remove element from collection"
b := x isEmpty.									"test if empty"
y := x size.										"number of elements"
y := x at: 2.										"retrieve element at index"
y := x first.										"retrieve first element in collection"
y := x last.										"retrieve last element in collection"
b := x includes: 5.								"test if element is in collection"
y := x copyFrom: 2 to: 3.						"subcollection"
y := x indexOf: 3 ifAbsent: [0].					"first position of element within collection"
y := x occurrencesOf: 3.						"number of times object in collection"
x do: [:a | Transcript show: a printString; cr].		"iterate over the collection"
b := x allSatisfy: [:a | (a >= 1) & (a <= 4)].		"test if all elements meet condition"
y := x select: [:a | a > 2].							"return collection of elements that pass test"
y := x reject: [:a | a < 2].							"return collection of elements that fail test"
y := x collect: [:a | a + a].						"transform each element for new collection"
y := x detect: [:a | a > 3] ifNone: [].				"return first element that passes test"
y := x findFirst: [:a | a < 2].						"find position of first element that passes test"
sum := 0. x do: [:a | sum := sum + a]. sum.		"sum elements"
sum := 0. 1 to: (x size) do: [:a | sum := sum + (x at: a)].	"sum elements"
sum := x inject: 0 into: [:a :c | a + c].				"sum elements"
max := x inject: 0 into: [:a :c | (a > c)				"find max element in collection"
ifTrue: [a]
ifFalse: [c]].
y := x shuffled.									"randomly shuffle collection"
y := x asArray.									"convert to array"
y := x asOrderedCollection.						"convert to ordered collection"
y := x asSortedCollection.						"convert to sorted collection"
y := x asBag.									"convert to bag collection"
y := x asSet.									"convert to set collection"

'!

Item was changed:
----- Method: TerseGuideHelp class>>pen (in category 'pages') -----
pen
+ 	"This method was automatically generated. Edit it using:"
+ 	"TerseGuideHelp edit: #pen"
-
^HelpTopic
title: 'Pen'
contents:

'"************************************************************************
* Pen:																				*
************************************************************************"
| myPen |
Display restoreAfter: [
Display fillWhite.

myPen := Pen new.								"get graphic pen"
myPen squareNib: 1.
myPen color: (Color blue).						"set pen color"
myPen home.									"position pen at center of display"
myPen up.										"makes nib unable to draw"
myPen down.									"enable the nib to draw"
myPen north.									"points direction towards top"
myPen turn: -180.								"add specified degrees to direction"
myPen direction.								"get current angle of pen"
myPen go: 50.									"move pen specified number of pixels"
myPen location.									"get the pen position"
myPen goto: 200 at 200.							"move to specified point"
myPen place: 250 at 250.						"move to specified point without drawing"
myPen print: ''Hello World'' withFont: (TextStyle default fontAt: 1).
Display extent.									"get display width at height"
Display width.									"get display width"
Display height.									"get display height"

].

'!

Item was changed:
----- Method: TerseGuideHelp class>>point (in category 'pages') -----
point
+ 	"This method was automatically generated. Edit it using:"
+ 	"TerseGuideHelp edit: #point"
-
^HelpTopic
title: 'Point'
contents:

'"************************************************************************
* Point:																				*
************************************************************************"
| x y |
x := 200 at 100.									"obtain a new point"
y := x x.											"x coordinate"
y := x y.											"y coordinate"
x := 200 at 100 negated.							"negates x and y"
x := (-200@ -100) abs.							"absolute value of x and y"
x := (200.5 at 100.5) rounded.					"round x and y"
x := (200.5 at 100.5) truncated.					"truncate x and y"
x := 200 at 100 + 100.							"add scale to both x and y"
x := 200 at 100 - 100.							"subtract scale from both x and y"
x := 200 at 100 * 2.								"multiply x and y by scale"
x := 200 at 100 / 2.								"divide x and y by scale"
x := 200 at 100 // 2.								"divide x and y by scale"
x := 200 at 100 \\ 3.								"remainder of x and y by scale"
x := 200 at 100 + (50 at 25).						"add points"
x := 200 at 100 - (50 at 25).						"subtract points"
x := 200 at 100 * (3 at 4).							"multiply points"
x := 200 at 100 // (3 at 4).							"divide points"
x := 200 at 100 max: 50 at 200.					"max x and y"
x := 200 at 100 min: 50 at 200.					"min x and y"
x := 20 at 5 dotProduct: 10 at 2.					"sum of product (x1*x2 + y1*y2)"

'!

Item was changed:
----- Method: TerseGuideHelp class>>rectangle (in category 'pages') -----
rectangle
+ 	"This method was automatically generated. Edit it using:"
+ 	"TerseGuideHelp edit: #rectangle"
-
^HelpTopic
title: 'Rectangle'
contents:

'"************************************************************************
* Rectangle:																		*
************************************************************************"
Rectangle fromUser.
Rectangle origin: 0 at 0 corner: 100 at 100		"Origin and corners are absolute points"
Rectangle origin: 80 at 40 extent: 50 at 50		"Extent is added to origin"
Rectangle center: 40 at 50 extent: 30 at 20		"Center is half of extent"
Rectangle left: 1 right: 20 top: 1 bottom: 10

| col |
col := OrderedCollection new.
col add: (Rectangle center: 40 at 50 extent: 30 at 20).
col add: (Rectangle left: 1 right: 20 top: 1 bottom: 10).
Rectangle merging: col

'!

Item was changed:
----- Method: TerseGuideHelp class>>set (in category 'pages') -----
set
+ 	"This method was automatically generated. Edit it using:"
+ 	"TerseGuideHelp edit: #set"
-
^HelpTopic
title: 'Set'
contents:

'"************************************************************************
* Set:           like Bag except duplicates not allowed								*
* IdentitySet:   uses identity test (== rather than =)								*
************************************************************************"
| b x y sum max |
x := Set with: 4 with: 3 with: 2 with: 1.			"create collection with up to 4 elements"
x := Set new.									"allocate collection"
y := x addAll: #(7 8 9).							"add multiple elements to collection"
y := x removeAll: #(7 8 9).						"remove multiple elements from collection"
y := x remove: 4 ifAbsent: [].					"remove element from collection"
b := x isEmpty.									"test if empty"
y := x size.										"number of elements"
x includes: 4.									"test if element is in collection"
x do: [:a | Transcript show: a printString; cr].		"iterate over the collection"
b := x allSatisfy: [:a | (a >= 1) & (a <= 4)].		"test if all elements meet condition"
y := x select: [:a | a > 2].							"return collection of elements that pass test"
y := x reject: [:a | a < 2].							"return collection of elements that fail test"
y := x collect: [:a | a + a].						"transform each element for new collection"
y := x detect: [:a | a > 3] ifNone: [].				"return first element that passes test"
sum := 0. x do: [:a | sum := sum + a]. sum.		"sum elements"
sum := x inject: 0 into: [:a :c | a + c].				"sum elements"
max := x inject: 0 into: [:a :c | (a > c)				"find max element in collection"
ifTrue: [a]
ifFalse: [c]].
y := x asArray.									"convert to array"
y := x asOrderedCollection.						"convert to ordered collection"
y := x asSortedCollection.						"convert to sorted collection"
y := x asBag.									"convert to bag collection"
y := x asSet.									"convert to set collection"

'!

Item was changed:
----- Method: TerseGuideHelp class>>sortedCollection (in category 'pages') -----
sortedCollection
+ 	"This method was automatically generated. Edit it using:"
+ 	"TerseGuideHelp edit: #sortedCollection"
-
^HelpTopic
title: 'Sorted Collection'
contents:

'"************************************************************************
* SortedCollection:    like OrderedCollection except order of elements			*
*                         determined by sorting criteria									*
************************************************************************"
| b x y sum max |
x := SortedCollection with: 4 with: 3 with: 2 with: 1.	"create collection with up to 4 elements"
x := SortedCollection new.							"allocate collection"
x := SortedCollection sortBlock: [:a :c | a > c].		"set sort criteria"
y := x removeFirst.									"remove first element in collection"
y := x removeLast.									"remove last element in collection"
y := x addAll: #(7 8 9).								"add multiple elements to collection"
y := x removeAll: #(7 8 9).							"remove multiple elements from collection"
y := x remove: 5 ifAbsent: [].						"remove element from collection"
b := x isEmpty.										"test if empty"
y := x size.											"number of elements"
y := x at: 2.											"retrieve element at index"
y := x first.											"retrieve first element in collection"
y := x last.											"retrieve last element in collection"
b := x includes: 4.									"test if element is in collection"
y := x copyFrom: 2 to: 3.							"subcollection"
y := x indexOf: 3 ifAbsent: [0].						"first position of element within collection"
y := x occurrencesOf: 3.							"number of times object in collection"
x do: [:a | Transcript show: a printString; cr].			"iterate over the collection"
b := x allSatisfy: [:a | (a >= 1) & (a <= 4)].			"test if all elements meet condition"
y := x select: [:a | a > 2].								"return collection of elements that pass test"
y := x reject: [:a | a < 2].								"return collection of elements that fail test"
y := x collect: [:a | a + a].							"transform each element for new collection"
y := x detect: [:a | a > 3] ifNone: [].					"return first element that passes test"
y := x findFirst: [:a | a < 3].							"find position of first element that passes test"
sum := 0. x do: [:a | sum := sum + a]. sum.			"sum elements"
sum := 0. 1 to: (x size) do: [:a | sum := sum + (x at: a)].	"sum elements"
sum := x inject: 0 into: [:a :c | a + c].					"sum elements"
max := x inject: 0 into: [:a :c | (a > c)					"find max element in collection"
ifTrue: [a]
ifFalse: [c]].
y := x asArray.										"convert to array"
y := x asOrderedCollection.							"convert to ordered collection"
y := x asSortedCollection.							"convert to sorted collection"
y := x asBag.										"convert to bag collection"
y := x asSet.										"convert to set collection"

'!

Item was changed:
----- Method: TerseGuideHelp class>>string (in category 'pages') -----
string
+ 	"This method was automatically generated. Edit it using:"
+ 	"TerseGuideHelp edit: #string"
-
^HelpTopic
title: 'String'
contents:

'"************************************************************************
* String:																			*
************************************************************************"
| b x y |
x := ''This is a string''.						"string assignment"
x := ''String'', ''Concatenation''.				"string concatenation"
b := x isEmpty.								"test if string is empty"
y := x size.									"string size"
y := x at: 2.									"char at location"
y := x copyFrom: 2 to: 4.					"substring"
y := x indexOf: \$a ifAbsent: [0].				"first position of character within string"
x := String new: 4.							"allocate string object"
x											"set string elements"
at: 1 put: \$a;
at: 2 put: \$b;
at: 3 put: \$c;
at: 4 put: \$e.
x := String with: \$a with: \$b with: \$c with: \$d.	"set up to 4 elements at a time"
x do: [:a | Transcript show: a printString; cr].		"iterate over the string"
b := x allSatisfy: [:a | (a >= \$a) & (a <= \$z)].	"test if all elements meet condition"
y := x select: [:a | a > \$a].					"return all elements that meet condition"
y := x asSymbol.							"convert string to symbol"
y := x asArray.								"convert string to array"
x := ''ABCD'' asByteArray.					"convert string to byte array"
y := x asOrderedCollection.					"convert string to ordered collection"
y := x asSortedCollection.					"convert string to sorted collection"
y := x asBag.								"convert string to bag collection"
y := x asSet.								"convert string to set collection"
y := x shuffled.								"randomly shuffle string"

'!

Item was changed:
----- Method: TerseGuideHelp class>>symbol (in category 'pages') -----
symbol
+ 	"This method was automatically generated. Edit it using:"
+ 	"TerseGuideHelp edit: #symbol"
-
^HelpTopic
title: 'Symbol'
contents:

'"************************************************************************
* Symbol:																			*
************************************************************************"
| b x y |
x := #Hello.									"symbol assignment"
y := #Symbol, ''Concatenation''.				"symbol concatenation (result is string)"
b := x isEmpty.								"test if symbol is empty"
y := x size.									"string size"
y := x at: 2.									"char at location"
y := x copyFrom: 2 to: 4.					"substring"
y := x indexOf: \$e ifAbsent: [0].				"first position of character within string"
x do: [:a | Transcript show: a printString; cr].	"iterate over the string"
b := x allSatisfy: [:a | (a >= \$a) & (a <= \$z)].	"test if all elements meet condition"
y := x select: [:a | a > \$a].					"return all elements that meet condition"
y := x asString.								"convert symbol to string"
y := x asText.								"convert symbol to text"
y := x asArray.								"convert symbol to array"
y := x asOrderedCollection.					"convert symbol to ordered collection"
y := x asSortedCollection.					"convert symbol to sorted collection"
y := x asBag.								"convert symbol to bag collection"
y := x asSet.								"convert symbol to set collection"

'!

Item was changed:
----- Method: TerseGuideHelp class>>time (in category 'pages') -----
time
+ 	"This method was automatically generated. Edit it using:"
+ 	"TerseGuideHelp edit: #time"
-
^HelpTopic
title: 'Time'
contents:

'"************************************************************************
* Time:																				*
************************************************************************"
| x y b |
x := Time now.									"create time from current time"
x := Time dateAndTimeNow.					"create time from current time/date"
x := Time readFromString: ''3:47:26 pm''.			"create time from formatted string"
x := Time fromSeconds: (60 * 60 * 4).			"create time from elapsed time from midnight"
y := Time millisecondClockValue.				"milliseconds since midnight"
y := Time totalSeconds.							"total seconds since 1/1/1901"
y := x seconds.									"seconds past minute (0-59)"
y := x minutes.									"minutes past hour (0-59)"
y := x hours.									"hours past midnight (0-23)"
y := x subtractTime: (Time now).				"subtract time to time object"
y := x asSeconds.								"convert time to seconds"
x := Time millisecondsToRun: [					"timing facility"
1 to: 1000 do: [:index | y := 3.14 * index]].
"b := (x <= Time now)."							"comparison"

'!

Item was changed:
----- Method: TerseGuideHelp class>>transcript (in category 'pages') -----
transcript
+ 	"This method was automatically generated. Edit it using:"
+ 	"TerseGuideHelp edit: #transcript"
-
^HelpTopic
title: 'Transcript'
contents:

'"************************************************************************
* Transcript:																		*
************************************************************************"
Transcript clear.						"clear to transcript window"
Transcript show: ''Hello World''.			"output string in transcript window"
Transcript nextPutAll: ''Hello World''.		"output string in transcript window"
Transcript nextPut: \$A.					"output character in transcript window"
Transcript space.						"output space character in transcript window"
Transcript tab.							"output tab character in transcript window"
Transcript cr.							"carriage return / linefeed"
''Hello'' printOn: Transcript.				"append print string into the window"
''Hello'' storeOn: Transcript.				"append store string into the window"
Transcript endEntry.					"flush the output buffer"

'!

```