Invoke an application. Returns a strin=
g containing the program's output to Standard Out

=20

input =3D shell("echo hi there&qu=
ot;, "")

=20

=20

=20

shellm

=20

Execute the specified managed application in=
a new AppDomain. Returns a string containing the=
program's output to Standard Out

=20

input =3D shellm("MyProgram.exe&q=
uot;, (,))

=20

=20

=20

enumerate

=20

Creates an IEnumerator from ano=
ther, but gives it a pairing of (index, =
value)

=20

List(enumerate(range(5, 8))) =3D=3D [(=
0, 5), (1, 6), (2, 7)]

=20

=20

=20

range

=20

Returns an IEnumerable containi=
ng a list of ints

=20

List(range(5)) =3D=3D [0, 1, 2, 3, 4]<=
/code>

=20

=20

=20

reversed

=20

Returns an IEnumerable with its=
members in reverse order

=20

List(reversed(range(5))) =3D=3D [4, 3,=
2, 1, 0]

=20

=20

=20

zip

=20

Returns an IEnumerable that is =
a "mesh" of two or more IEnumerables.

=20

array(zip([1, 2, 3], [4, 5, 6])) =3D=
=3D [(1, 4), (2, 5), (3, 6)]

=20

=20

=20

cat

=20

Concatenate two or more IEnumerators=
code> head-to-tail

=20

List(cat(range(3), range(3, 6))) =3D=
=3D [0, 1, 2, 3, 4, 5]

=20

=20

=20

These are all very handy to know. Not required, but it makes programming=
all that much easier.

=20

Defining Your Own Functions

=20

It's very simple to define your own functions as well.

=20

declaring a function

=20

def Hello():
return "Hello, World!"
print Hello()

=20

=20

Output

=20

Hello, World!

=20

=20

Now it's ok if you don't understand any of that, I'll go through it step=
-by-step.

=20
=20

def Hello():=20

=20

def declares that you are starting to declare a function. =
def is short for "define".

=20

Hello is the name of the function. You could call it almos=
t anything you wanted, as long as it doesn't have any spaces and doesn't st=
art with a number.

=20

() this means what kind of arguments the function will tak=
e. Since we don't accept any arguments, it is left blank.

=20

=20
=20
=20

=20
=20

return "Hello, World!"=20

=20

return is a keyword that lets the function know what to em=
it to its invoker.

=20

"Hello, World!" is the string that =
the return statement will send.

=20

=20

=20

print Hello()=20

=20

print is the happy little print macro that we=
covered before.

=20

Hello() calls the Hello function with no () arguments.

=20

=20
=20

Like variables, function types are inferred.

=20

=20

def Hello():
return "Hello, World!"

=20

=20

will always return a string, so Boo will will infer that string is its return type. You could have done this to achieve the same resul=
t:

=20

=20

def Hello() as string:
return "Hello, World!"

=20

=20

=20

Recommendation

=20
Icon=20

=20

If it is not obvious, specify the return type for a function.

=20

=20

=20

If Boo cannot infer a return type, it will assume object. I=
f there is no return type then the return type is called 'void', which basi=
cally means nothing. To have no return type you can leave off the ret=
urn, or have a return with no expression. If there are =
multiple return}}s with different {{return types, it will return the closest common ancestor, often times object but not always.

=20

Arguments

=20

=20

Definition: Argument

=20
Icon=20

=20

A way of allowing the same sequence of commands to operate on different =
data without re-specifying the instructions.

=20

=20

=20

Arguments are very handy, as they can allow a function to do different t=
hings based on the input.

Hello is the name of the function. You could call it almos=
t anything you wanted, as long as it doesn't have any spaces and doesn't st=
art with a number.

=20

(name as string) this means what kind of arguments the fun=
ction will take. This function will take one argument: name. W=
hen you call the function, the name must be a string, otherwis=
e you will get a compiler error - "The best overload for the method He=
llo is not compatible with the argument list '(The,Types, of, The, Paramete=
rs, Entered)'."

=20

=20
=20
=20

=20
=20

return "Hello, ${name}!"=20

=20

return is a keyword that exits the function, and optionall=
y return a value to the caller.

Hello("Monkey") calls the Hello fun=
ction with the ("Monkey") argument.

=20

=20
=20

Function=
Overloading

=20

=20

Definition: Overloading

=20
Icon=20

=20

Giving multiple meanings to the same name, but making them distinguishab=
le by context. For example, two procedures with the same name are overloadi=
ng that name as long as the compiler can determine which one you mean from =
contextual information such as the type and number of parameters that you s=
upply when you call it.

=20

=20

=20

Function overloading takes place when a function is declared multiple ti=
mes with different arguments.

The star * lets it known that everything past that is arbitrary. I=
t is also used to explode parameters, as in print Test(*a) cau=
ses 3 arguments to be passed. You can have required parameters before=
the *args, just like in any other function, but not after, as after all th=
e required parameters are supplied the rest are past into your argument arr=
ay.

=20

Exercises

=20
=20

Write a function that prints something nice if it is fed an even number=
and prints something mean if it is fed an odd number.