summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--chapel.html.markdown202
-rw-r--r--css.html.markdown6
-rw-r--r--python3.html.markdown62
-rw-r--r--ru-ru/ruby-ru.html.markdown1
-rw-r--r--smalltalk.html.markdown955
5 files changed, 1121 insertions, 105 deletions
diff --git a/chapel.html.markdown b/chapel.html.markdown
index 05e5b867..02a96b04 100644
--- a/chapel.html.markdown
+++ b/chapel.html.markdown
@@ -27,7 +27,7 @@ writeln( "There are ", 3, " commas (\",\") in this line of code" );
stdout.writeln( "This goes to standard output, just like plain writeln() does");
stderr.writeln( "This goes to standard error" );
-// Variables don't have to be explicitly typed as long as
+// Variables don't have to be explicitly typed as long as
// the compiler can figure out the type that it will hold.
var myVar = 10; // 10 is an int, so myVar is implicitly an int
myVar = -10;
@@ -65,9 +65,9 @@ const almostPi: real = 22.0/7.0;
param compileTimeConst: int = 16;
// The config modifier allows values to be set at the command line
-// and is much easier than the usual getOpts debacle
+// and is much easier than the usual getOpts debacle
// config vars and consts can be changed through the command line at run time
-config var varCmdLineArg: int = -123;
+config var varCmdLineArg: int = -123;
config const constCmdLineArg: int = 777;
// Set with --VarName=Value or --VarName Value at run time
@@ -119,9 +119,9 @@ a *= thatInt; // Times-equals ( a = a * thatInt; )
b &&= thatBool; // Logical-and-equals ( b = b && thatBool; )
a <<= 3; // Left-bit-shift-equals ( a = a << 10; )
// and many, many more.
-// Unlike other C family languages there are no
+// Unlike other C family languages there are no
// pre/post-increment/decrement operators like
-// ++j, --j, j++, j--
+// ++j, --j, j++, j--
// Swap operator
var old_this = thisInt;
@@ -155,7 +155,7 @@ writeln( (a,b,thisInt,thatInt,thisBool,thatBool) );
// Type aliasing
type chroma = int; // Type of a single hue
-type RGBColor = 3*chroma; // Type representing a full color
+type RGBColor = 3*chroma; // Type representing a full color
var black: RGBColor = ( 0,0,0 );
var white: RGBColor = ( 255, 255, 255 );
@@ -198,7 +198,7 @@ select( inputOption ){
writeln( "Chose 'otherOption'" );
writeln( "Which has a body" );
}
- otherwise {
+ otherwise {
writeln( "Any other Input" );
writeln( "the otherwise case doesn't need a do if the body is one line" );
}
@@ -221,7 +221,7 @@ do{
writeln( jSum );
// For loops are much like those in python in that they iterate over a range.
-// Ranges themselves are types, and can be stuffed into variables
+// Ranges themselves are types, and can be stuffed into variables
// (more about that later)
for i in 1..10 do write( i , ", ") ;
writeln( );
@@ -240,28 +240,28 @@ for x in 1..10 {
}
// Ranges and Domains
-// For-loops and arrays both use ranges and domains to
+// For-loops and arrays both use ranges and domains to
// define an index set that can be iterated over.
// Ranges are single dimensional
-// Domains can be multi-dimensional and can
+// Domains can be multi-dimensional and can
// represent indices of different types as well.
// They are first-class citizen types, and can be assigned into variables
var range1to10: range = 1..10; // 1, 2, 3, ..., 10
var range2to11 = 2..11; // 2, 3, 4, ..., 11
var rangeThistoThat: range = thisInt..thatInt; // using variables
-var rangeEmpty: range = 100..-100 ; // this is valid but contains no indices
+var rangeEmpty: range = 100..-100 ; // this is valid but contains no indices
-// Ranges can be unbounded
-var range1toInf: range(boundedType=BoundedRangeType.boundedLow) = 1.. ;
+// Ranges can be unbounded
+var range1toInf: range(boundedType=BoundedRangeType.boundedLow) = 1.. ;
// 1, 2, 3, 4, 5, ...
-// Note: the range(boundedType= ... ) is only
+// Note: the range(boundedType= ... ) is only
// necessary if we explicitly type the variable
var rangeNegInfto1 = ..1; // ..., -4, -3, -2, -1, 0, 1
// Ranges can be strided using the 'by' operator.
var range2to10by2: range(stridable=true) = 2..10 by 2; // 2, 4, 6, 8, 10
-// Note: the range(stridable=true) is only
+// Note: the range(stridable=true) is only
// necessary if we explicitly type the variable
// Use by to create a reverse range
@@ -275,9 +275,9 @@ var rangeCountBy: range(stridable=true) = -5..#12 by 2; // -5, -3, -1, 1, 3, 5
writeln( rangeCountBy );
// Can query properties of the range
-// Print the first index, last index, number of indices,
+// Print the first index, last index, number of indices,
// stride, and ask if 2 is include in the range
-writeln( ( rangeCountBy.first, rangeCountBy.last, rangeCountBy.length,
+writeln( ( rangeCountBy.first, rangeCountBy.last, rangeCountBy.length,
rangeCountBy.stride, rangeCountBy.member( 2 ) ) );
for i in rangeCountBy{
@@ -309,7 +309,7 @@ stringSet += "b";
stringSet += "c";
stringSet += "a"; // Redundant add "a"
stringSet -= "c"; // Remove "c"
-writeln( stringSet );
+writeln( stringSet );
// Both ranges and domains can be sliced to produce a range or domain with the
// intersection of indices
@@ -332,13 +332,13 @@ var intArray2: [{1..10}] int; //equivalent
for i in 1..10 do
intArray[i] = -i;
writeln( intArray );
-// We cannot access intArray[0] because it exists outside
+// We cannot access intArray[0] because it exists outside
// of the index set, {1..10}, we defined it to have.
// intArray[11] is illegal for the same reason.
var realDomain: domain(2) = {1..5,1..7};
var realArray: [realDomain] real;
-var realArray2: [1..5,1..7] real; // Equivalent
+var realArray2: [1..5,1..7] real; // Equivalent
var realArray3: [{1..5,1..7}] real; // Equivalent
for i in 1..5 {
@@ -350,8 +350,8 @@ for i in 1..5 {
}
// Arrays have domains as members that we can iterate over
-for idx in realArray.domain { // Again, idx is a 2*int tuple
- realArray[idx] = 1 / realArray[idx[1],idx[2]]; // Access by tuple and list
+for idx in realArray.domain { // Again, idx is a 2*int tuple
+ realArray[idx] = 1 / realArray[idx[1],idx[2]]; // Access by tuple and list
}
writeln( realArray );
@@ -377,7 +377,7 @@ var thatArray : [{0..5}] int;
// Simply assign one to the other.
// This copies thisArray into thatArray, instead of just creating a reference.
// Modifying thisArray does not also modify thatArray.
-thatArray = thisArray;
+thatArray = thisArray;
thatArray[1] = -1;
writeln( (thisArray, thatArray) );
@@ -389,12 +389,12 @@ writeln( (thisArray, thatArray) );
var thisPlusThat = thisArray + thatArray;
writeln( thisPlusThat );
-// Arrays and loops can also be expressions, where loop
+// Arrays and loops can also be expressions, where loop
// body's expression is the result of each iteration.
var arrayFromLoop = for i in 1..10 do i;
writeln( arrayFromLoop );
-// An expression can result in nothing,
+// An expression can result in nothing,
// such as when filtering with an if-expression
var evensOrFives = for i in 1..10 do if (i % 2 == 0 || i % 5 == 0) then i;
@@ -407,7 +407,7 @@ var evensOrFivesAgain = [ i in 1..10 ] if (i % 2 == 0 || i % 5 == 0) then i;
// Or over the values of the array
arrayFromLoop = [ value in arrayFromLoop ] value + 1;
-// Note: this notation can get somewhat tricky. For example:
+// Note: this notation can get somewhat tricky. For example:
// evensOrFives = [ i in 1..10 ] if (i % 2 == 0 || i % 5 == 0) then i;
// would break.
// The reasons for this are explained in depth when discussing zipped iterators.
@@ -431,7 +431,7 @@ proc addThree( n ) {
doublePrint( addThree( fibonacci( 20 ) ) );
// Can also take 'unlimited' number of parameters
-proc maxOf( x ...?k ) {
+proc maxOf( x ...?k ) {
// x refers to a tuple of one type, with k elements
var maximum = x[1];
for i in 2..k do maximum = if (maximum < x[i]) then x[i] else maximum;
@@ -439,7 +439,7 @@ proc maxOf( x ...?k ) {
}
writeln( maxOf( 1, -10, 189, -9071982, 5, 17, 20001, 42 ) );
-// The ? operator is called the query operator, and is used to take
+// The ? operator is called the query operator, and is used to take
// undetermined values (like tuple or array sizes, and generic types).
// Taking arrays as parameters.
@@ -463,7 +463,7 @@ writeln( defaultsProc( x=11 ) );
writeln( defaultsProc( x=12, y=5.432 ) );
writeln( defaultsProc( y=9.876, x=13 ) );
-// Intent modifiers on the arguments convey how
+// Intent modifiers on the arguments convey how
// those arguments are passed to the procedure
// in: copy arg in, but not out
// out: copy arg out, but not in
@@ -489,18 +489,18 @@ writeln( "Outside After: ", (inVar, outVar, inoutVar, refVar) );
// Similarly we can define intents on the return type
// refElement returns a reference to an element of array
proc refElement( array : [?D] ?T, idx ) ref : T {
- return array[ idx ]; // returns a reference to
+ return array[ idx ]; // returns a reference to
}
var myChangingArray : [1..5] int = [1,2,3,4,5];
writeln( myChangingArray );
-// Store reference to element in ref variable
-ref refToElem = refElement( myChangingArray, 5 );
+// Store reference to element in ref variable
+ref refToElem = refElement( myChangingArray, 5 );
writeln( refToElem );
refToElem = -2; // modify reference which modifies actual value in array
writeln( refToElem );
writeln( myChangingArray );
-// This makes more practical sense for class methods where references to
+// This makes more practical sense for class methods where references to
// elements in a data-structure are returned via a method or iterator
// We can query the type of arguments to generic procedures
@@ -520,7 +520,7 @@ genericProc( 1.0+2.0i, 3.0+4.0i );
// We can also enforce a form of polymorphism with the 'where' clause
// This allows the compiler to decide which function to use.
-// Note: that means that all information needs to be known at compile-time.
+// Note: that means that all information needs to be known at compile-time.
// The param modifier on the arg is used to enforce this constraint.
proc whereProc( param N : int ): void
where ( N > 0 ) {
@@ -534,7 +534,7 @@ proc whereProc( param N : int ): void
whereProc( 10 );
whereProc( -1 );
-// whereProc( 0 ) would result in a compiler error because there
+// whereProc( 0 ) would result in a compiler error because there
// are no functions that satisfy the where clause's condition.
// We could have defined a whereProc without a where clause that would then have
// served as a catch all for all the other cases (of which there is only one).
@@ -543,7 +543,7 @@ whereProc( -1 );
// We can define the unary operators:
// + - ! ~
// and the binary operators:
-// + - * / % ** == <= >= < > << >> & | ˆ by
+// + - * / % ** == <= >= < > << >> & | ˆ by
// += -= *= /= %= **= &= |= ˆ= <<= >>= <=>
// Boolean exclusive or operator
@@ -569,14 +569,14 @@ Note: You could break everything if you get careless with your overloads.
This here will break everything. Don't do it.
proc +( left: int, right: int ): int{
return left - right;
-}
+}
*/
-// Iterators are a sisters to the procedure, and almost
+// Iterators are a sisters to the procedure, and almost
// everything about procedures also applies to iterators
-// However, instead of returning a single value,
+// However, instead of returning a single value,
// iterators yield many values to a loop.
-// This is useful when a complicated set or order of iterations is needed but
+// This is useful when a complicated set or order of iterations is needed but
// allows the code defining the iterations to be separate from the loop body.
iter oddsThenEvens( N: int ): int {
for i in 1..N by 2 do
@@ -601,15 +601,15 @@ for i in absolutelyNothing( 10 ){
writeln( "Woa there! absolutelyNothing yielded ", i );
}
-// We can zipper together two or more iterators (who have the same number
-// of iterations) using zip() to create a single zipped iterator, where each
-// iteration of the zipped iterator yields a tuple of one value yielded
+// We can zipper together two or more iterators (who have the same number
+// of iterations) using zip() to create a single zipped iterator, where each
+// iteration of the zipped iterator yields a tuple of one value yielded
// from each iterator.
// Ranges have implicit iterators
-for (positive, negative) in zip( 1..5, -5..-1) do
+for (positive, negative) in zip( 1..5, -5..-1) do
writeln( (positive, negative) );
-// Zipper iteration is quite important in the assignment of arrays,
+// Zipper iteration is quite important in the assignment of arrays,
// slices of arrays, and array/loop expressions.
var fromThatArray : [1..#5] int = [1,2,3,4,5];
var toThisArray : [100..#5] int;
@@ -629,10 +629,10 @@ for (i, j) in zip( toThisArray.domain, -100..#5 ){
}
writeln( toThisArray );
-// This is all very important in undestanding why the statement
+// This is all very important in undestanding why the statement
// var iterArray : [1..10] int = [ i in 1..10 ] if ( i % 2 == 1 ) then j;
// exhibits a runtime error.
-// Even though the domain of the array and the loop-expression are
+// Even though the domain of the array and the loop-expression are
// the same size, the body of the expression can be though of as an iterator.
// Because iterators can yield nothing, that iterator yields a different number
// of things than the domain of the array or loop, which is not allowed.
@@ -641,8 +641,8 @@ writeln( toThisArray );
// They currently lack privatization
class MyClass {
// Member variables
- var memberInt : int;
- var memberBool : bool = true;
+ var memberInt : int;
+ var memberBool : bool = true;
// Classes have default constructors that don't need to be coded (see below)
// Our explicitly defined constructor
@@ -659,28 +659,28 @@ class MyClass {
proc setMemberInt( val: int ){
this.memberInt = val;
}
-
+
proc setMemberBool( val: bool ){
this.memberBool = val;
}
- proc getMemberInt( ): int{
+ proc getMemberInt( ): int{
return this.memberInt;
}
proc getMemberBool( ): bool {
return this.memberBool;
}
-
+
}
-
+
// Construct using default constructor, using default values
var myObject = new MyClass( 10 );
myObject = new MyClass( memberInt = 10 ); // Equivalent
writeln( myObject.getMemberInt( ) );
// ... using our values
var myDiffObject = new MyClass( -1, true );
- myDiffObject = new MyClass( memberInt = -1,
+ myDiffObject = new MyClass( memberInt = -1,
memberBool = true ); // Equivalent
writeln( myDiffObject );
@@ -689,7 +689,7 @@ var myOtherObject = new MyClass( 1.95 );
myOtherObject = new MyClass( val = 1.95 ); // Equivalent
writeln( myOtherObject.getMemberInt( ) );
-// We can define an operator on our class as well but
+// We can define an operator on our class as well but
// the definition has to be outside the class definition
proc +( A : MyClass, B : MyClass) : MyClass {
return new MyClass( memberInt = A.getMemberInt( ) + B.getMemberInt( ),
@@ -715,46 +715,46 @@ class GenericClass {
type classType;
var classDomain: domain(1);
var classArray: [classDomain] classType;
-
+
// Explicit constructor
proc GenericClass( type classType, elements : int ){
this.classDomain = {1..#elements};
}
-
+
// Copy constructor
- // Note: We still have to put the type as an argument, but we can
+ // Note: We still have to put the type as an argument, but we can
// default to the type of the other object using the query (?) operator
// Further, we can take advantage of this to allow our copy constructor
// to copy classes of different types and cast on the fly
- proc GenericClass( other : GenericClass(?otherType),
+ proc GenericClass( other : GenericClass(?otherType),
type classType = otherType ) {
this.classDomain = other.classDomain;
// Copy and cast
- for idx in this.classDomain do this[ idx ] = other[ idx ] : classType;
+ for idx in this.classDomain do this[ idx ] = other[ idx ] : classType;
}
-
- // Define bracket notation on a GenericClass
+
+ // Define bracket notation on a GenericClass
// object so it can behave like a normal array
// i.e. objVar[ i ] or objVar( i )
proc this( i : int ) ref : classType {
return this.classArray[ i ];
}
-
- // Define an implicit iterator for the class
+
+ // Define an implicit iterator for the class
// to yield values from the array to a loop
// i.e. for i in objVar do ....
iter these( ) ref : classType {
for i in this.classDomain do
yield this[i];
}
-
+
}
var realList = new GenericClass( real, 10 );
-// We can assign to the member array of the object using the bracket
+// We can assign to the member array of the object using the bracket
// notation that we defined ( proc this( i: int ){ ... } )
for i in realList.classDomain do realList[i] = i + 1.0;
-// We can iterate over the values in our list with the iterator
+// We can iterate over the values in our list with the iterator
// we defined ( iter these( ){ ... } )
for value in realList do write( value, ", " );
writeln( );
@@ -777,23 +777,23 @@ writeln( );
module OurModule {
// We can use modules inside of other modules.
use Time; // Time is one of the standard modules.
-
+
// We'll use this procedure in the parallelism section.
proc countdown( seconds: int ){
for i in 1..seconds by -1 {
writeln( i );
sleep( 1 );
}
- }
-
- // Submodules of OurModule
+ }
+
+ // Submodules of OurModule
// It is possible to create arbitrarily deep module nests.
module ChildModule {
proc foo(){
writeln( "ChildModule.foo()");
}
}
-
+
module SiblingModule {
proc foo(){
writeln( "SiblingModule.foo()" );
@@ -806,7 +806,7 @@ module OurModule {
use OurModule;
// At this point we have not used ChildModule or SiblingModule so their symbols
-// (i.e. foo ) are not available to us.
+// (i.e. foo ) are not available to us.
// However, the module names are, and we can explicitly call foo() through them.
SiblingModule.foo(); // Calls SiblingModule.foo()
@@ -821,13 +821,13 @@ foo(); // Less explicit call on ChildModule.foo()
proc main(){
// Parallelism
- // In other languages, parallelism is typically done with
+ // In other languages, parallelism is typically done with
// complicated libraries and strange class structure hierarchies.
// Chapel has it baked right into the language.
- // A begin statement will spin the body of that statement off
+ // A begin statement will spin the body of that statement off
// into one new task.
- // A sync statement will ensure that the progress of the main
+ // A sync statement will ensure that the progress of the main
// task will not progress until the children have synced back up.
sync {
begin { // Start of new task's body
@@ -848,7 +848,7 @@ proc main(){
printFibb( 20 ); // new task
printFibb( 10 ); // new task
printFibb( 5 ); // new task
- {
+ {
// This is a nested statement body and thus is a single statement
// to the parent statement and is executed by a single task
writeln( "this gets" );
@@ -867,26 +867,26 @@ proc main(){
// NOTE! coforall should be used only for creating tasks!
// Using it to iterating over a structure is very a bad idea!
- // forall loops are another parallel loop, but only create a smaller number
+ // forall loops are another parallel loop, but only create a smaller number
// of tasks, specifically --dataParTasksPerLocale=number of task
forall i in 1..100 {
write( i, ", ");
}
writeln( );
- // Here we see that there are sections that are in order, followed by
+ // Here we see that there are sections that are in order, followed by
// a section that would not follow ( e.g. 1, 2, 3, 7, 8, 9, 4, 5, 6, ).
// This is because each task is taking on a chunk of the range 1..10
// (1..3, 4..6, or 7..9) doing that chunk serially, but each task happens
// in parallel.
// Your results may depend on your machine and configuration
- // For both the forall and coforall loops, the execution of the
+ // For both the forall and coforall loops, the execution of the
// parent task will not continue until all the children sync up.
// forall loops are particularly useful for parallel iteration over arrays.
// Lets run an experiment to see how much faster a parallel loop is
use Time; // Import the Time module to use Timer objects
- var timer: Timer;
+ var timer: Timer;
var myBigArray: [{1..4000,1..4000}] real; // Large array we will write into
// Serial Experiment
@@ -906,7 +906,7 @@ proc main(){
timer.stop( ); // Stop timer
writeln( "Parallel: ", timer.elapsed( ) ); // Print elapsed time
timer.clear( );
- // You may have noticed that (depending on how many cores you have)
+ // You may have noticed that (depending on how many cores you have)
// that the parallel loop went faster than the serial loop
// The bracket style loop-expression described
@@ -926,15 +926,15 @@ proc main(){
writeln( uranium.read() );
var replaceWith = 239;
- var was = uranium.exchange( replaceWith );
+ var was = uranium.exchange( replaceWith );
writeln( "uranium was ", was, " but is now ", replaceWith );
var isEqualTo = 235;
if ( uranium.compareExchange( isEqualTo, replaceWith ) ) {
- writeln( "uranium was equal to ", isEqualTo,
+ writeln( "uranium was equal to ", isEqualTo,
" so replaced value with ", replaceWith );
} else {
- writeln( "uranium was not equal to ", isEqualTo,
+ writeln( "uranium was not equal to ", isEqualTo,
" so value stays the same... whatever it was" );
}
@@ -960,13 +960,13 @@ proc main(){
begin { // Reader task
writeln( "Reader: waiting to read." );
var read_sync = someSyncVar$;
- writeln( "value is ", read_sync );
+ writeln( "Reader: value is ", read_sync );
}
begin { // Writer task
writeln( "Writer: will write in..." );
countdown( 3 );
- someSyncVar$ = 123;
+ someSyncVar$ = 123;
}
}
@@ -989,14 +989,14 @@ proc main(){
}
}
- // Heres an example of using atomics and a synch variable to create a
+ // Heres an example of using atomics and a synch variable to create a
// count-down mutex (also known as a multiplexer)
var count: atomic int; // our counter
var lock$: sync bool; // the mutex lock
count.write( 2 ); // Only let two tasks in at a time.
lock$.writeXF( true ); // Set lock$ to full (unlocked)
- // Note: The value doesnt actually matter, just the state
+ // Note: The value doesnt actually matter, just the state
// (full:unlocked / empty:locked)
// Also, writeXF() fills (F) the sync var regardless of its state (X)
@@ -1005,10 +1005,10 @@ proc main(){
do{
lock$; // Read lock$ (wait)
}while ( count.read() < 1 ); // Keep waiting until a spot opens up
-
+
count.sub(1); // decrement the counter
lock$.writeXF( true ); // Set lock$ to full (signal)
-
+
// Actual 'work'
writeln( "Task #", task, " doing work." );
sleep( 2 );
@@ -1027,13 +1027,13 @@ proc main(){
// 'maxloc' gives max value and index of the max value
// Note: We have to zip the array and domain together with the zip iterator
- var (theMaxValue, idxOfMax) = maxloc reduce zip(listOfValues,
+ var (theMaxValue, idxOfMax) = maxloc reduce zip(listOfValues,
listOfValues.domain);
-
+
writeln( (sumOfValues, maxValue, idxOfMax, listOfValues[ idxOfMax ] ) );
// Scans apply the operation incrementally and return an array of the
- // value of the operation at that index as it progressed through the
+ // value of the operation at that index as it progressed through the
// array from array.domain.low to array.domain.high
var runningSumOfValues = + scan listOfValues;
var maxScan = max scan listOfValues;
@@ -1046,14 +1046,14 @@ Who is this tutorial for?
-------------------------
This tutorial is for people who want to learn the ropes of chapel without having to hear about what fiber mixture the ropes are, or how they were braided, or how the braid configurations differ between one another.
-It won't teach you how to develop amazingly performant code, and it's not exhaustive.
+It won't teach you how to develop amazingly performant code, and it's not exhaustive.
Refer to the [language specification](http://chapel.cray.com/language.html) and the [module documentation](http://chapel.cray.com/docs/latest/) for more details.
Occasionally check back here and on the [Chapel site](http://chapel.cray.com) to see if more topics have been added or more tutorials created.
### What this tutorial is lacking:
- * Exposition of the standard modules
+ * Exposition of the [standard modules](http://chapel.cray.com/docs/latest/modules/modules.html)
* Multiple Locales (distributed memory system)
* Records
* Parallel iterators
@@ -1061,11 +1061,11 @@ Occasionally check back here and on the [Chapel site](http://chapel.cray.com) to
Your input, questions, and discoveries are important to the developers!
-----------------------------------------------------------------------
-The Chapel language is still in-development (version 1.11.0), so there are occasional hiccups with performance and language features.
+The Chapel language is still in-development (version 1.12.0), so there are occasional hiccups with performance and language features.
The more information you give the Chapel development team about issues you encounter or features you would like to see, the better the language becomes.
Feel free to email the team and other developers through the [sourceforge email lists](https://sourceforge.net/p/chapel/mailman).
-If you're really interested in the development of the compiler or contributing to the project,
+If you're really interested in the development of the compiler or contributing to the project,
[check out the master Github repository](https://github.com/chapel-lang/chapel).
It is under the [Apache 2.0 License](http://www.apache.org/licenses/LICENSE-2.0).
@@ -1074,10 +1074,10 @@ Installing the Compiler
Chapel can be built and installed on your average 'nix machine (and cygwin).
[Download the latest release version](https://github.com/chapel-lang/chapel/releases/)
-and it's as easy as
+and it's as easy as
- 1. `tar -xvf chapel-1.11.0.tar.gz`
- 2. `cd chapel-1.11.0`
+ 1. `tar -xvf chapel-1.12.0.tar.gz`
+ 2. `cd chapel-1.12.0`
3. `make`
4. `source util/setchplenv.bash # or .sh or .csh or .fish`
diff --git a/css.html.markdown b/css.html.markdown
index 7224d80a..e217906f 100644
--- a/css.html.markdown
+++ b/css.html.markdown
@@ -4,6 +4,7 @@ contributors:
- ["Mohammad Valipour", "https://github.com/mvalipour"]
- ["Marco Scannadinari", "https://github.com/marcoms"]
- ["Geoffrey Liu", "https://github.com/g-liu"]
+ - ["Connor Shea", "https://github.com/connorshea"]
filename: learncss.css
---
@@ -238,10 +239,13 @@ of what you use in CSS with your target browsers.
[QuirksMode CSS](http://www.quirksmode.org/css/) is one of the best sources for this.
-To run a quick compatibility check, [CanIUse](http://caniuse.com) is a great resource.
+To run a quick compatibility check, [Can I Use...](http://caniuse.com) is a great resource.
## Further Reading
+* [Mozilla Developer Network's CSS documentation](https://developer.mozilla.org/en-US/docs/Web/CSS)
+* [Codrops' CSS Reference](http://tympanus.net/codrops/css_reference/)
* [Understanding Style Precedence in CSS: Specificity, Inheritance, and the Cascade](http://www.vanseodesign.com/css/css-specificity-inheritance-cascaade/)
* [QuirksMode CSS](http://www.quirksmode.org/css/)
* [Z-Index - The stacking context](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Understanding_z_index/The_stacking_context)
+* [SCSS](http://sass-lang.com/) and [LESS](http://lesscss.org/) for CSS pre-processing
diff --git a/python3.html.markdown b/python3.html.markdown
index b3acb122..971ca0a4 100644
--- a/python3.html.markdown
+++ b/python3.html.markdown
@@ -4,6 +4,7 @@ contributors:
- ["Louie Dinh", "http://pythonpracticeprojects.com"]
- ["Steven Basart", "http://github.com/xksteven"]
- ["Andre Polykanine", "https://github.com/Oire"]
+ - ["Zachary Ferguson", "http://github.com/zfergus2"]
filename: learnpython3.py
---
@@ -36,7 +37,7 @@ Note: This article applies to Python 3 specifically. Check out [here](http://lea
8 - 1 # => 7
10 * 2 # => 20
-# Except division which returns floats by default
+# Except division which returns floats, real numbers, by default
35 / 5 # => 7.0
# Result of integer division truncated down both for positive and negative.
@@ -51,13 +52,13 @@ Note: This article applies to Python 3 specifically. Check out [here](http://lea
# Modulo operation
7 % 3 # => 1
-# Exponentiation (x to the yth power)
+# Exponentiation (x**y, x to the yth power)
2**4 # => 16
# Enforce precedence with parentheses
(1 + 3) * 2 # => 8
-# Boolean values are primitives
+# Boolean values are primitives (Note: the capitalization)
True
False
@@ -95,6 +96,16 @@ False or True #=> True
1 < 2 < 3 # => True
2 < 3 < 2 # => False
+# (is vs. ==) is checks if two variable refer to the same object, but == checks
+# if the objects pointed to have the same values.
+a = [1, 2, 3, 4] # Point a at a new list, [1, 2, 3, 4]
+b = a # Point b at what a is pointing to
+b is a # => True, a and b refer to the same object
+b == a # => True, a's and b's objects are equal
+b = [1, 2, 3, 4] # Point a at a new list, [1, 2, 3, 4]
+b is a # => False, a and b do not refer to the same object
+b == a # => True, a's and b's objects are equal
+
# Strings are created with " or '
"This is a string."
'This is also a string.'
@@ -145,6 +156,10 @@ bool({}) #=> False
# Python has a print function
print("I'm Python. Nice to meet you!")
+# By default the print function also prints out a newline at the end.
+# Use the optional argument end to change the end character.
+print("Hello, World", end="!") # => Hello, World!
+
# No need to declare variables before assigning to them.
# Convention is to use lower_case_with_underscores
some_var = 5
@@ -191,6 +206,9 @@ li[::-1] # => [3, 4, 2, 1]
# Use any combination of these to make advanced slices
# li[start:end:step]
+# Make a one layer deep copy using slices
+li2 = li[:] # => li2 = [1, 2, 4, 3] but (li2 is li) will result in false.
+
# Remove arbitrary elements from a list with "del"
del li[2] # li is now [1, 2, 3]
@@ -213,6 +231,12 @@ tup = (1, 2, 3)
tup[0] # => 1
tup[0] = 3 # Raises a TypeError
+# Note that a tuple of length one has to have a comma after the last element but
+# tuples of other lengths, even zero, do not.
+type((1)) # => <class 'int'>
+type((1,)) # => <class 'tuple'>
+type(()) # => <class 'tuple'>
+
# You can do most of the list operations on tuples too
len(tup) # => 3
tup + (4, 5, 6) # => (1, 2, 3, 4, 5, 6)
@@ -232,6 +256,12 @@ empty_dict = {}
# Here is a prefilled dictionary
filled_dict = {"one": 1, "two": 2, "three": 3}
+# Note keys for dictionaries have to be immutable types. This is to ensure that
+# the key can be converted to a constant hash value for quick look-ups.
+# Immutable types include ints, floats, strings, tuples.
+invalid_dict = {[1,2,3]: "123"} # => Raises a TypeError: unhashable type: 'list'
+valid_dict = {(1,2,3):[1,2,3]} # Values can be of any type, however.
+
# Look up values with []
filled_dict["one"] # => 1
@@ -278,6 +308,10 @@ empty_set = set()
# Initialize a set with a bunch of values. Yeah, it looks a bit like a dict. Sorry.
some_set = {1, 1, 2, 2, 3, 4} # some_set is now {1, 2, 3, 4}
+# Similar to keys of a dictionary, elements of a set have to be immutable.
+invalid_set = {[1], 1} # => Raises a TypeError: unhashable type: 'list'
+valid_set = {(1,), 1}
+
# Can set new variables to a set
filled_set = some_set
@@ -299,6 +333,7 @@ filled_set | other_set # => {1, 2, 3, 4, 5, 6}
10 in filled_set # => False
+
####################################################
## 3. Control Flow and Iterables
####################################################
@@ -352,6 +387,18 @@ for i in range(4, 8):
print(i)
"""
+"range(lower, upper, step)" returns an iterable of numbers
+from the lower number to the upper number, while incrementing
+by step. If step is not indicated, the default value is 1.
+prints:
+ 4
+ 6
+ 8
+"""
+for i in range(4, 8, 2):
+ print(i)
+"""
+
While loops go until a condition is no longer met.
prints:
0
@@ -464,6 +511,15 @@ all_the_args(*args) # equivalent to foo(1, 2, 3, 4)
all_the_args(**kwargs) # equivalent to foo(a=3, b=4)
all_the_args(*args, **kwargs) # equivalent to foo(1, 2, 3, 4, a=3, b=4)
+# Returning multiple values (with tuple assignments)
+def swap(x, y):
+ return y, x # Return multiple values as a tuple without the parenthesis.
+ # (Note: parenthesis have been excluded but can be included)
+
+x = 1
+y = 2
+x, y = swap(x, y) # => x = 2, y = 1
+# (x, y) = swap(x,y) # Again parenthesis have been excluded but can be included.
# Function Scope
x = 5
diff --git a/ru-ru/ruby-ru.html.markdown b/ru-ru/ruby-ru.html.markdown
index 318e0e09..69b5fb46 100644
--- a/ru-ru/ruby-ru.html.markdown
+++ b/ru-ru/ruby-ru.html.markdown
@@ -158,6 +158,7 @@ array << 6 #=> [1, 2, 3, 4, 5, 6]
hash = {'color' => 'green', 'number' => 5}
hash.keys #=> ['color', 'number']
+hash.values #=> ['green', 5]
# Значение в хэше легко может быть найдено по ключу:
hash['color'] #=> 'green'
diff --git a/smalltalk.html.markdown b/smalltalk.html.markdown
new file mode 100644
index 00000000..a434a1ad
--- /dev/null
+++ b/smalltalk.html.markdown
@@ -0,0 +1,955 @@
+---
+language: smalltalk
+contributors:
+ - ["Jigyasa Grover", "https://github.com/jig08"]
+---
+
+- Smalltalk is an object-oriented, dynamically typed, reflective programming language.
+- Smalltalk was created as the language to underpin the "new world" of computing exemplified by "human–computer symbiosis."
+- It was designed and created in part for educational use, more so for constructionist learning, at the Learning Research Group (LRG) of Xerox PARC by Alan Kay, Dan Ingalls, Adele Goldberg, Ted Kaehler, Scott Wallace, and others during the 1970s.
+
+Feedback highly appreciated! Reach me at [@jigyasa_grover](https://twitter.com/jigyasa_grover) or send me an e-mail at `grover.jigyasa1@gmail.com`.
+
+
+##Allowable characters:
+- a-z
+- A-Z
+- 0-9
+- .+/\*~<>@%|&?
+- blank, tab, cr, ff, lf
+
+##Variables:
+- variables must be declared before use
+- shared vars must begin with uppercase
+- local vars must begin with lowercase
+- reserved names: `nil`, `true`, `false`, `self`, `super`, and `Smalltalk`
+
+##Variable scope:
+- Global: defined in Dictionary Smalltalk and accessible by all objects in system - Special: (reserved) `Smalltalk`, `super`, `self`, `true`, `false`, & `nil`
+- Method Temporary: local to a method
+- Block Temporary: local to a block
+- Pool: variables in a Dictionary object
+- Method Parameters: automatic local vars created as a result of message call with params
+- Block Parameters: automatic local vars created as a result of value: message call
+- Class: shared with all instances of one class & its subclasses
+- Class Instance: unique to each instance of a class
+- Instance Variables: unique to each instance
+
+`"Comments are enclosed in quotes"`
+
+`"Period (.) is the statement seperator"`
+
+## 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"
+```
+
+##Assignment:
+```
+| x y |
+x _ 4. "assignment (Squeak) <-"
+x := 5. "assignment"
+x := y := z := 6. "compound assignment"
+x := (y := 6) + 1.
+x := Object new. "bind to allocated instance of a class"
+x := 123 class. "discover the object class"
+x := Integer superclass. "discover the superclass of a class"
+x := Object allInstances. "get an array of all instances of a class"
+x := Integer allSuperclasses. "get all superclasses of a class"
+x := 1.2 hash. "hash value for object"
+y := x copy. "copy object"
+y := x shallowCopy. "copy object (not overridden)"
+y := x deepCopy. "copy object and instance vars"
+y := x veryDeepCopy. "complete tree copy using a dictionary"
+```
+
+##Constants:
+```
+| b |
+b := true. "true constant"
+b := false. "false constant"
+x := nil. "nil object constant"
+x := 1. "integer constants"
+x := 3.14. "float constants"
+x := 2e-2. "fractional constants"
+x := 16r0F. "hex constant".
+x := -1. "negative constants"
+x := 'Hello'. "string constant"
+x := 'I''m here'. "single quote escape"
+x := $A. "character constant"
+x := $ . "character constant (space)"
+x := #aSymbol. "symbol constants"
+x := #(3 2 1). "array constants"
+x := #('abc' 2 $a). "mixing of types allowed"
+
+```
+
+## Booleans:
+```
+| b x y |
+x := 1. y := 2.
+b := (x = y). "equals"
+b := (x ~= y). "not equals"
+b := (x == y). "identical"
+b := (x ~~ y). "not identical"
+b := (x > y). "greater than"
+b := (x < y). "less than"
+b := (x >= y). "greater than or equal"
+b := (x <= y). "less than or equal"
+b := b not. "boolean not"
+b := (x < 5) & (y > 1). "boolean and"
+b := (x < 5) | (y > 1). "boolean or"
+b := (x < 5) and: [y > 1]. "boolean and (short-circuit)"
+b := (x < 5) or: [y > 1]. "boolean or (short-circuit)"
+b := (x < 5) eqv: (y > 1). "test if both true or both false"
+b := (x < 5) xor: (y > 1). "test if one true and other false"
+b := 5 between: 3 and: 12. "between (inclusive)"
+b := 123 isKindOf: Number. "test if object is class or subclass of"
+b := 123 isMemberOf: SmallInteger. "test if object is type of class"
+b := 123 respondsTo: sqrt. "test if object responds to message"
+b := x isNil. "test if object is nil"
+b := x isZero. "test if number is zero"
+b := x positive. "test if number is positive"
+b := x strictlyPositive. "test if number is greater than zero"
+b := x negative. "test if number is negative"
+b := x even. "test if number is even"
+b := x odd. "test if number is odd"
+b := x isLiteral. "test if literal constant"
+b := x isInteger. "test if object is integer"
+b := x isFloat. "test if object is float"
+b := x isNumber. "test if object is number"
+b := $A isUppercase. "test if upper case character"
+b := $A isLowercase. "test if lower case character"
+
+```
+
+## Arithmetic expressions:
+```
+| x |
+x := 6 + 3. "addition"
+x := 6 - 3. "subtraction"
+x := 6 * 3. "multiplication"
+x := 1 + 2 * 3. "evaluation always left to right (1 + 2) * 3"
+x := 5 / 3. "division with fractional result"
+x := 5.0 / 3.0. "division with float result"
+x := 5.0 // 3.0. "integer divide"
+x := 5.0 \\ 3.0. "integer remainder"
+x := -5. "unary minus"
+x := 5 sign. "numeric sign (1, -1 or 0)"
+x := 5 negated. "negate receiver"
+x := 1.2 integerPart. "integer part of number (1.0)"
+x := 1.2 fractionPart. "fractional part of number (0.2)"
+x := 5 reciprocal. "reciprocal function"
+x := 6 * 3.1. "auto convert to float"
+x := 5 squared. "square function"
+x := 25 sqrt. "square root"
+x := 5 raisedTo: 2. "power function"
+x := 5 raisedToInteger: 2. "power function with integer"
+x := 5 exp. "exponential"
+x := -5 abs. "absolute value"
+x := 3.99 rounded. "round"
+x := 3.99 truncated. "truncate"
+x := 3.99 roundTo: 1. "round to specified decimal places"
+x := 3.99 truncateTo: 1. "truncate to specified decimal places"
+x := 3.99 floor. "truncate"
+x := 3.99 ceiling. "round up"
+x := 5 factorial. "factorial"
+x := -5 quo: 3. "integer divide rounded toward zero"
+x := -5 rem: 3. "integer remainder rounded toward zero"
+x := 28 gcd: 12. "greatest common denominator"
+x := 28 lcm: 12. "least common multiple"
+x := 100 ln. "natural logarithm"
+x := 100 log. "base 10 logarithm"
+x := 100 log: 10. "logarithm with specified base"
+x := 100 floorLog: 10. "floor of the log"
+x := 180 degreesToRadians. "convert degrees to radians"
+x := 3.14 radiansToDegrees. "convert radians to degrees"
+x := 0.7 sin. "sine"
+x := 0.7 cos. "cosine"
+x := 0.7 tan. "tangent"
+x := 0.7 arcSin. "arcsine"
+x := 0.7 arcCos. "arccosine"
+x := 0.7 arcTan. "arctangent"
+x := 10 max: 20. "get maximum of two numbers"
+x := 10 min: 20. "get minimum of two numbers"
+x := Float pi. "pi"
+x := Float e. "exp constant"
+x := Float infinity. "infinity"
+x := Float nan. "not-a-number"
+x := Random new next; yourself. x next. "random number stream (0.0 to 1.0)
+x := 100 atRandom. "quick random number"
+
+```
+
+##Bitwise Manipulation:
+```
+| b x |
+x := 16rFF bitAnd: 16r0F. "and bits"
+x := 16rF0 bitOr: 16r0F. "or bits"
+x := 16rFF bitXor: 16r0F. "xor bits"
+x := 16rFF bitInvert. "invert bits"
+x := 16r0F bitShift: 4. "left shift"
+x := 16rF0 bitShift: -4. "right shift"
+"x := 16r80 bitAt: 7." "bit at position (0|1) [!Squeak]"
+x := 16r80 highbit. "position of highest bit set"
+b := 16rFF allMask: 16r0F. "test if all bits set in mask set in receiver"
+b := 16rFF anyMask: 16r0F. "test if any bits set in mask set in receiver"
+b := 16rFF noMask: 16r0F. "test if all bits set in mask clear in receiver"
+
+```
+
+## Conversion:
+```
+| x |
+x := 3.99 asInteger. "convert number to integer (truncates in Squeak)"
+x := 3.99 asFraction. "convert number to fraction"
+x := 3 asFloat. "convert number to float"
+x := 65 asCharacter. "convert integer to character"
+x := $A asciiValue. "convert character to integer"
+x := 3.99 printString. "convert object to string via printOn:"
+x := 3.99 storeString. "convert object to string via storeOn:"
+x := 15 radix: 16. "convert to string in given base"
+x := 15 printStringBase: 16.
+x := 15 storeStringBase: 16.
+
+```
+
+## Blocks:
+- blocks are objects and may be assigned to a variable
+- value is last expression evaluated unless explicit return
+- blocks may be nested
+- specification [ arguments | | localvars | expressions ]
+- Squeak does not currently support localvars in blocks
+- max of three arguments allowed
+- `^`expression terminates block & method (exits all nested blocks)
+- blocks intended for long term storage should not contain `^`
+
+```
+| x y z |
+x := [ y := 1. z := 2. ]. x value. "simple block usage"
+x := [ :argOne :argTwo | argOne, ' and ' , argTwo.]. "set up block with argument passing"
+Transcript show: (x value: 'First' value: 'Second'); cr. "use block with argument passing"
+"x := [ | z | z := 1.]. *** localvars not available in squeak blocks"
+```
+
+## 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)
+- updating (receive notification of changes)
+- 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"
+Transcript "Cascading - send multiple messages to receiver"
+ show: 'hello ';
+ show: 'world';
+ cr.
+x := 3 + 2; * 100. "result=300. Sends message to same receiver (3)"
+```
+
+##Conditional Statements:
+```
+| x |
+x > 10 ifTrue: [Transcript show: 'ifTrue'; cr]. "if then"
+x > 10 ifFalse: [Transcript show: 'ifFalse'; cr]. "if else"
+x > 10 "if then else"
+ ifTrue: [Transcript show: 'ifTrue'; cr]
+ ifFalse: [Transcript show: 'ifFalse'; cr].
+x > 10 "if else then"
+ ifFalse: [Transcript show: 'ifFalse'; cr]
+ ifTrue: [Transcript show: 'ifTrue'; cr].
+Transcript
+ show:
+ (x > 10
+ ifTrue: ['ifTrue']
+ ifFalse: ['ifFalse']);
+ cr.
+Transcript "nested if then else"
+ show:
+ (x > 10
+ ifTrue: [x > 5
+ ifTrue: ['A']
+ ifFalse: ['B']]
+ ifFalse: ['C']);
+ cr.
+switch := Dictionary new. "switch functionality"
+switch at: $A put: [Transcript show: 'Case A'; cr].
+switch at: $B put: [Transcript show: 'Case B'; cr].
+switch at: $C put: [Transcript show: 'Case C'; cr].
+result := (switch at: $B) value.
+```
+
+## 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"
+```
+
+## Character:
+```
+| x y |
+x := $A. "character assignment"
+y := x isLowercase. "test if lower case"
+y := x isUppercase. "test if upper case"
+y := x isLetter. "test if letter"
+y := x isDigit. "test if digit"
+y := x isAlphaNumeric. "test if alphanumeric"
+y := x isSeparator. "test if seperator char"
+y := x isVowel. "test if vowel"
+y := x digitValue. "convert to numeric digit value"
+y := x asLowercase. "convert to lower case"
+y := x asUppercase. "convert to upper case"
+y := x asciiValue. "convert to numeric ascii value"
+y := x asString. "convert to string"
+b := $A <= $B. "comparison"
+y := $A max: $B.
+
+```
+
+## Symbol:
+```
+| b x y |
+x := #Hello. "symbol assignment"
+y := 'String', '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 conform: [: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"
+```
+
+## 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 conform: [: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"
+```
+
+## Array: Fixed length collection
+- ByteArray: Array limited to byte elements (0-255)
+- WordArray: Array limited to word elements (0-2^32)
+
+```
+| b x y sum max |
+x := #(4 3 2 1). "constant array"
+x := Array with: 5 with: 4 with: 3 with: 2. "create array with up to 4 elements"
+x := Array new: 4. "allocate an array with specified size"
+x "set array elements"
+ at: 1 put: 5;
+ at: 2 put: 4;
+ at: 3 put: 3;
+ at: 4 put: 2.
+b := x isEmpty. "test if array is empty"
+y := x size. "array size"
+y := x at: 4. "get array element at index"
+b := x includes: 3. "test if element is in array"
+y := x copyFrom: 2 to: 4. "subarray"
+y := x indexOf: 3 ifAbsent: [0]. "first position of element within array"
+y := x occurrencesOf: 3. "number of times object in collection"
+x do: [:a | Transcript show: a printString; cr]. "iterate over the array"
+b := x conform: [: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: []. "find position of first element that passes test"
+sum := 0. x do: [:a | sum := sum + a]. sum. "sum array elements"
+sum := 0. 1 to: (x size) do: [:a | sum := sum + (x at: a)]. "sum array elements"
+sum := x inject: 0 into: [:a :c | a + c]. "sum array elements"
+max := x inject: 0 into: [:a :c | (a > c) "find max element in array"
+ ifTrue: [a]
+ ifFalse: [c]].
+y := x shuffled. "randomly shuffle collection"
+y := x asArray. "convert to array"
+"y := x asByteArray." "note: this instruction not available on Squeak"
+y := x asWordArray. "convert to word 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"
+```
+
+##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"
+x add: 3; add: 2; add: 1; add: 4; yourself. "add element to collection"
+y := x addFirst: 5. "add element at beginning of collection"
+y := x removeFirst. "remove first element in collection"
+y := x addLast: 6. "add element at end of 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 conform: [: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: []. "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"
+```
+
+## 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"
+x add: 3; add: 2; add: 1; add: 4; yourself. "add element to collection"
+y := x addFirst: 5. "add element at beginning of collection"
+y := x removeFirst. "remove first element in collection"
+y := x addLast: 6. "add element at end of 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 conform: [: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: []. "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"
+```
+
+## Bag: like OrderedCollection except elements are in no particular order
+```
+| b x y sum max |
+x := Bag with: 4 with: 3 with: 2 with: 1. "create collection with up to 4 elements"
+x := Bag new. "allocate collection"
+x add: 4; add: 3; add: 1; add: 2; yourself. "add element to collection"
+x add: 3 withOccurrences: 2. "add multiple copies to 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"
+b := x includes: 3. "test if element is in 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 conform: [: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: []. "find position of 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 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"
+```
+
+## 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"
+x add: 4; add: 3; add: 1; add: 2; yourself. "add element to 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 conform: [: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: []. "find position of 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"
+```
+
+## Interval:
+```
+| b x y sum max |
+x := Interval from: 5 to: 10. "create interval object"
+x := 5 to: 10.
+x := Interval from: 5 to: 10 by: 2. "create interval object with specified increment"
+x := 5 to: 10 by: 2.
+b := x isEmpty. "test if empty"
+y := x size. "number of elements"
+x includes: 9. "test if element is in collection"
+x do: [:k | Transcript show: k printString; cr]. "iterate over interval"
+b := x conform: [:a | (a >= 1) & (a <= 4)]. "test if all elements meet condition"
+y := x select: [:a | a > 7]. "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: []. "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"
+```
+
+##Associations:
+```
+| x y |
+x := #myVar->'hello'.
+y := x key.
+y := x value.
+```
+
+## Dictionary:
+## IdentityDictionary: uses identity test (== rather than =)
+```
+| b x y |
+x := Dictionary new. "allocate collection"
+x add: #a->4; add: #b->3; add: #c->1; add: #d->2; yourself. "add element to collection"
+x at: #e put: 3. "set element at index"
+b := x isEmpty. "test if empty"
+y := x size. "number of elements"
+y := x at: #a ifAbsent: []. "retrieve element at index"
+y := x keyAtValue: 3 ifAbsent: []. "retrieve key for given value with error block"
+y := x removeKey: #e ifAbsent: []. "remove element from collection"
+b := x includes: 3. "test if element is in values collection"
+b := x includesKey: #a. "test if element is in keys collection"
+y := x occurrencesOf: 3. "number of times object in collection"
+y := x keys. "set of keys"
+y := x values. "bag of values"
+x do: [:a | Transcript show: a printString; cr]. "iterate over the values collection"
+x keysDo: [:a | Transcript show: a printString; cr]. "iterate over the keys collection"
+x associationsDo: [:a | Transcript show: a printString; cr]."iterate over the associations"
+x keysAndValuesDo: [:aKey :aValue | Transcript "iterate over keys and values"
+ show: aKey printString; space;
+ show: aValue printString; cr].
+b := x conform: [: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: []. "find position of 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"
+
+Smalltalk at: #CMRGlobal put: 'CMR entry'. "put global in Smalltalk Dictionary"
+x := Smalltalk at: #CMRGlobal. "read global from Smalltalk Dictionary"
+Transcript show: (CMRGlobal printString). "entries are directly accessible by name"
+Smalltalk keys do: [ :k | "print out all classes"
+ ((Smalltalk at: k) isKindOf: Class)
+ ifFalse: [Transcript show: k printString; cr]].
+Smalltalk at: #CMRDictionary put: (Dictionary new). "set up user defined dictionary"
+CMRDictionary at: #MyVar1 put: 'hello1'. "put entry in dictionary"
+CMRDictionary add: #MyVar2->'hello2'. "add entry to dictionary use key->value combo"
+CMRDictionary size. "dictionary size"
+CMRDictionary keys do: [ :k | "print out keys in dictionary"
+ Transcript show: k printString; cr].
+CMRDictionary values do: [ :k | "print out values in dictionary"
+ Transcript show: k printString; cr].
+CMRDictionary keysAndValuesDo: [:aKey :aValue | "print out keys and values"
+ Transcript
+ show: aKey printString;
+ space;
+ show: aValue printString;
+ cr].
+CMRDictionary associationsDo: [:aKeyValue | "another iterator for printing key values"
+ Transcript show: aKeyValue printString; cr].
+Smalltalk removeKey: #CMRGlobal ifAbsent: []. "remove entry from Smalltalk dictionary"
+Smalltalk removeKey: #CMRDictionary ifAbsent: []. "remove user dictionary from Smalltalk dictionary"
+```
+
+## Internal Stream:
+```
+| b x ios |
+ios := ReadStream on: 'Hello read stream'.
+ios := ReadStream on: 'Hello read stream' from: 1 to: 5.
+[(x := ios nextLine) notNil]
+ whileTrue: [Transcript show: x; cr].
+ios position: 3.
+ios position.
+x := ios next.
+x := ios peek.
+x := ios contents.
+b := ios atEnd.
+
+ios := ReadWriteStream on: 'Hello read stream'.
+ios := ReadWriteStream on: 'Hello read stream' from: 1 to: 5.
+ios := ReadWriteStream with: 'Hello read stream'.
+ios := ReadWriteStream with: 'Hello read stream' from: 1 to: 10.
+ios position: 0.
+[(x := ios nextLine) notNil]
+ whileTrue: [Transcript show: x; cr].
+ios position: 6.
+ios position.
+ios nextPutAll: 'Chris'.
+x := ios next.
+x := ios peek.
+x := ios contents.
+b := ios atEnd.
+```
+
+## FileStream:
+```
+| b x ios |
+ios := FileStream newFileNamed: 'ios.txt'.
+ios nextPut: $H; cr.
+ios nextPutAll: 'Hello File'; cr.
+'Hello File' printOn: ios.
+'Hello File' storeOn: ios.
+ios close.
+
+ios := FileStream oldFileNamed: 'ios.txt'.
+[(x := ios nextLine) notNil]
+ whileTrue: [Transcript show: x; cr].
+ios position: 3.
+x := ios position.
+x := ios next.
+x := ios peek.
+b := ios atEnd.
+ios close.
+```
+
+## Date:
+```
+| x y |
+x := Date today. "create date for today"
+x := Date dateAndTimeNow. "create date from current time/date"
+x := Date readFromString: '01/02/1999'. "create date from formatted string"
+x := Date newDay: 12 month: #July year: 1999 "create date from parts"
+x := Date fromDays: 36000. "create date from elapsed days since 1/1/1901"
+y := Date dayOfWeek: #Monday. "day of week as int (1-7)"
+y := Date indexOfMonth: #January. "month of year as int (1-12)"
+y := Date daysInMonth: 2 forYear: 1996. "day of month as int (1-31)"
+y := Date daysInYear: 1996. "days in year (365|366)"
+y := Date nameOfDay: 1 "weekday name (#Monday,...)"
+y := Date nameOfMonth: 1. "month name (#January,...)"
+y := Date leapYear: 1996. "1 if leap year; 0 if not leap year"
+y := x weekday. "day of week (#Monday,...)"
+y := x previous: #Monday. "date for previous day of week"
+y := x dayOfMonth. "day of month (1-31)"
+y := x day. "day of year (1-366)"
+y := x firstDayOfMonth. "day of year for first day of month"
+y := x monthName. "month of year (#January,...)"
+y := x monthIndex. "month of year (1-12)"
+y := x daysInMonth. "days in month (1-31)"
+y := x year. "year (19xx)"
+y := x daysInYear. "days in year (365|366)"
+y := x daysLeftInYear. "days left in year (364|365)"
+y := x asSeconds. "seconds elapsed since 1/1/1901"
+y := x addDays: 10. "add days to date object"
+y := x subtractDays: 10. "subtract days to date object"
+y := x subtractDate: (Date today). "subtract date (result in days)"
+y := x printFormat: #(2 1 3 $/ 1 1). "print formatted date"
+b := (x <= Date today). "comparison"
+```
+
+## Time:
+```
+| x y |
+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 addTime: (Time now). "add time to time object"
+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"
+```
+
+## Point:
+```
+| x y |
+x := 200@100. "obtain a new point"
+y := x x. "x coordinate"
+y := x y. "y coordinate"
+x := 200@100 negated. "negates x and y"
+x := (-200@-100) abs. "absolute value of x and y"
+x := (200.5@100.5) rounded. "round x and y"
+x := (200.5@100.5) truncated. "truncate x and y"
+x := 200@100 + 100. "add scale to both x and y"
+x := 200@100 - 100. "subtract scale from both x and y"
+x := 200@100 * 2. "multiply x and y by scale"
+x := 200@100 / 2. "divide x and y by scale"
+x := 200@100 // 2. "divide x and y by scale"
+x := 200@100 \\ 3. "remainder of x and y by scale"
+x := 200@100 + 50@25. "add points"
+x := 200@100 - 50@25. "subtract points"
+x := 200@100 * 3@4. "multiply points"
+x := 200@100 // 3@4. "divide points"
+x := 200@100 max: 50@200. "max x and y"
+x := 200@100 min: 50@200. "min x and y"
+x := 20@5 dotProduct: 10@2. "sum of product (x1*x2 + y1*y2)"
+```
+
+## Rectangle:
+```
+Rectangle fromUser.
+```
+
+## 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@200. "move to specified point"
+myPen place: 250@250. "move to specified point without drawing"
+myPen print: 'Hello World' withFont: (TextStyle default fontAt: 1).
+Display extent. "get display width@height"
+Display width. "get display width"
+Display height. "get display height"
+
+].
+```
+
+## Dynamic Message Calling/Compiling:
+```
+| receiver message result argument keyword1 keyword2 argument1 argument2 |
+"unary message"
+receiver := 5.
+message := 'factorial' asSymbol.
+result := receiver perform: message.
+result := Compiler evaluate: ((receiver storeString), ' ', message).
+result := (Message new setSelector: message arguments: #()) sentTo: receiver.
+
+"binary message"
+receiver := 1.
+message := '+' asSymbol.
+argument := 2.
+result := receiver perform: message withArguments: (Array with: argument).
+result := Compiler evaluate: ((receiver storeString), ' ', message, ' ', (argument storeString)).
+result := (Message new setSelector: message arguments: (Array with: argument)) sentTo: receiver.
+
+"keyword messages"
+receiver := 12.
+keyword1 := 'between:' asSymbol.
+keyword2 := 'and:' asSymbol.
+argument1 := 10.
+argument2 := 20.
+result := receiver
+ perform: (keyword1, keyword2) asSymbol
+ withArguments: (Array with: argument1 with: argument2).
+result := Compiler evaluate:
+ ((receiver storeString), ' ', keyword1, (argument1 storeString) , ' ', keyword2, (argument2 storeString)).
+result := (Message
+ new
+ setSelector: (keyword1, keyword2) asSymbol
+ arguments: (Array with: argument1 with: argument2))
+ sentTo: receiver.
+```
+
+## 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: #size. "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"
+```
+
+## Debuging:
+```
+| a b x |
+x yourself. "returns receiver"
+String browse. "browse specified class"
+x inspect. "open object inspector window"
+x confirm: 'Is this correct?'.
+x halt. "breakpoint to open debugger window"
+x halt: 'Halt message'.
+x notify: 'Notify text'.
+x error: 'Error string'. "open up error window with title"
+x doesNotUnderstand: #cmrMessage. "flag message is not handled"
+x shouldNotImplement. "flag message should not be implemented"
+x subclassResponsibility. "flag message as abstract"
+x errorImproperStore. "flag an improper store into indexable object"
+x errorNonIntegerIndex. "flag only integers should be used as index"
+x errorSubscriptBounds. "flag subscript out of bounds"
+x primitiveFailed. "system primitive failed"
+
+a := 'A1'. b := 'B2'. a become: b. "switch two objects"
+Transcript show: a, b; cr.
+```
+
+## Misc
+```
+| x |
+"Smalltalk condenseChanges." "compress the change file"
+x := FillInTheBlank request: 'Prompt Me'. "prompt user for input"
+Utilities openCommandKeyHelp
+```
+
+
+
+
+## Ready For More?
+
+### Free Online
+
+* [GNU Smalltalk User's Guide](https://www.gnu.org/software/smalltalk/manual/html_node/Tutorial.html)
+* [smalltalk dot org](http://www.smalltalk.org/smalltalk/learning.html)
+* [Computer Programming using GNU Smalltalk](http://www.canol.info/books/computer_programming_using_gnu_smalltalk/)
+* [Smalltalk Cheatsheet](http://www.angelfire.com/tx4/cus/notes/smalltalk.html)
+* [Smalltalk-72 Manual](http://www.bitsavers.org/pdf/xerox/parc/techReports/Smalltalk-72_Instruction_Manual_Mar76.pdf)
+* [BYTE: A Special issue on Smalltalk](https://archive.org/details/byte-magazine-1981-08)
+* [Smalltalk, Objects, and Design](https://books.google.co.in/books?id=W8_Une9cbbgC&printsec=frontcover&dq=smalltalk&hl=en&sa=X&ved=0CCIQ6AEwAWoVChMIw63Vo6CpyAIV0HGOCh3S2Alf#v=onepage&q=smalltalk&f=false)
+* [Smalltalk: An Introduction to Application Development Using VisualWorks](https://books.google.co.in/books?id=zalQAAAAMAAJ&q=smalltalk&dq=smalltalk&hl=en&sa=X&ved=0CCgQ6AEwAmoVChMIw63Vo6CpyAIV0HGOCh3S2Alf/)