Spellcheck

This commit is contained in:
Ian Bertolacci 2015-07-17 10:24:16 -07:00
parent 77c4ddb522
commit e7fe0b267a

View File

@ -117,7 +117,7 @@ a = thisInt ^ thatInt; // Bitwise exclusive-or
a += thisInt; // Addition-equals ( a = a + thisInt;) a += thisInt; // Addition-equals ( a = a + thisInt;)
a *= thatInt; // Times-equals ( a = a * thatInt; ) a *= thatInt; // Times-equals ( a = a * thatInt; )
b &&= thatBool; // Logical-and-equals ( b = b && thatBool; ) b &&= thatBool; // Logical-and-equals ( b = b && thatBool; )
a <<= 3; // LEft-bit-shift-equals ( a = a << 10; ) a <<= 3; // Left-bit-shift-equals ( a = a << 10; )
// and many, many more. // 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 // pre/post-increment/decrement operators like
@ -190,7 +190,7 @@ if ( a % 3 == 0 ) {
var maximum = if ( thisInt < thatInt ) then thatInt else thisInt; var maximum = if ( thisInt < thatInt ) then thatInt else thisInt;
// Select statements are much like switch statements in other languages // Select statements are much like switch statements in other languages
// However, Select statements dont cascade like in C or Java // However, Select statements don't cascade like in C or Java
var inputOption = "anOption"; var inputOption = "anOption";
select( inputOption ){ select( inputOption ){
when "anOption" do writeln( "Chose 'anOption'" ); when "anOption" do writeln( "Chose 'anOption'" );
@ -201,8 +201,6 @@ select( inputOption ){
otherwise { otherwise {
writeln( "Any other Input" ); writeln( "Any other Input" );
writeln( "the otherwise case doesn't need a do if the body is one line" ); writeln( "the otherwise case doesn't need a do if the body is one line" );
writeln( "Oh, and when statements dont cascade like the case statements" );
writeln( "of other languages" );
} }
} }
@ -246,7 +244,7 @@ for x in 1..10 {
// define an index set that can be iterated over. // define an index set that can be iterated over.
// Ranges are single dimensional // Ranges are single dimensional
// Domains can be multi-dimensional and can // Domains can be multi-dimensional and can
// represent indicies of different types as well. // represent indices of different types as well.
// They are first-class citizen types, and can be assigned into variables // They are first-class citizen types, and can be assigned into variables
var range1to10: range = 1..10; // 1, 2, 3, ..., 10 var range1to10: range = 1..10; // 1, 2, 3, ..., 10
var range2to11 = 2..11; // 2, 3, 4, ..., 11 var range2to11 = 2..11; // 2, 3, 4, ..., 11
@ -452,7 +450,7 @@ writeln( myChangingArray );
// We can query the type of arguments to generic procedures // We can query the type of arguments to generic procedures
// Here we define a procedure that takes two arguments of // Here we define a procedure that takes two arguments of
// the same type, yet we dont define what that type is. // the same type, yet we don't define what that type is.
proc genericProc( arg1 : ?valueType, arg2 : valueType ): void { proc genericProc( arg1 : ?valueType, arg2 : valueType ): void {
select( valueType ){ select( valueType ){
when int do writeln( arg1, " and ", arg2, " are ints" ); when int do writeln( arg1, " and ", arg2, " are ints" );
@ -620,10 +618,10 @@ class GenericClass {
} }
// Copy constructor // Copy constructor
// Note: We still have to put the 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 // default to the type of the other object using the query (?) operator
// Further, we can take advantage of this to allow our copy constructor // Further, we can take advantage of this to allow our copy constructor
// to copy classes of different types // to copy classes of different types and cast on the fly
proc GenericClass( other : GenericClass(?otherType), proc GenericClass( other : GenericClass(?otherType),
type classType = otherType ) { type classType = otherType ) {
this.classDomain = other.classDomain; this.classDomain = other.classDomain;