Re: Myster Tour
------=_NextPart_000_0056_01C00397.A9E9F100
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Paul, sounds like you need to RTFM.
In lieu of that, here's this:
function simple_sort(sequence x) -- how does one use =
function? and what does simple_sort(sequence x) mean?=20
A function returns a value, whereas a procedure does not. So, you =
would use this function this way:
aValue =3D simple_sort( aSequence)
where aSequence is a sequence, or list, of values, whether string =
types or other...
The (sequence x) part simply tells the programmer what data the =
function needs in order to work properly. In this case, =
simple_sort(sequence x) is looking to receive a sequence, which it will =
refer to as 'x,' because it's reason for being is to take unsorted =
sequences and sort them.
for i =3D 1 to length(x) + 1 do -- is length(x) the =
legnth of simple_sort? if so, why not just for i=3D1 to =
length(simple_sort)
Here, the function "length" is providing a value for the "for" =
statement. Why it needs to add one to it would take more investigating =
than I have time for right now.
for j =3D i + 1 to length(x) do
if compare(x[j],x[i]) < 0 then -- \
-- swap x[j], x[i] -- \
temp =3D x[j] -- ---- =
I need these ones explained, I've got no idea what they mean
x[j] =3D x[i] -- /
x[i] =3D temp -- /
end if
end for
The brackets are simply pointing to a value in the sequence (or =
array).
If we have a sequence composed of five elements, called janitor:
janitor =3D { 1 , "B" , { 1 , "CB" } , xray , "plunk" }
then element 5, accessed as follows:
vVar =3D janitor[5]
vVar would be "plunk".
return x -- whats return do?
Returns the value to the calling program, indicating that the function =
is done processing.
------=_NextPart_000_0056_01C00397.A9E9F100
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2722.2800" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT size=3D2>Paul, sounds like you need to RTFM.
</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=3D2>In lieu of that, here's this:</FONT></DIV>
<BLOCKQUOTE=20
style=3D"BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: =
0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">
<DIV><FONT face=3DArial size=3D2>function simple_sort(sequence=20
x) -- how =
does one=20
use function? and what does simple_sort(sequence x) mean? =
</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=3D2><STRONG>A function returns a value, whereas a =
procedure does=20
not. So, you would use this function this way:</STRONG></FONT></DIV>
<DIV> </DIV>
<DIV><STRONG><FONT size=3D2> aValue =3D =
simple_sort(=20
aSequence)</FONT></STRONG></DIV>
<DIV> </DIV>
<DIV><FONT size=3D2><STRONG>where aSequence is a sequence, or list, of =
values,=20
whether string types or other...</STRONG></FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=3D2><STRONG>The (sequence x) part simply tells the =
programmer=20
what data the function needs in order to work properly. In this case,=20
simple_sort(sequence x) is looking to receive a sequence, which it =
will refer=20
to as 'x,' because it's reason for being is to take unsorted sequences =
and=20
sort them.</STRONG></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> for i =3D 1 to =
length(x) + 1=20
do =
=20
-- is length(x) the legnth of simple_sort? if so, why not just for =
i=3D1 to=20
length(simple_sort)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT size=3D2><STRONG>Here, the function "length" is providing a =
value for=20
the "for" statement. Why it needs to add one to it would take more=20
investigating than I have time for right now.</STRONG></FONT></DIV>
<DIV><FONT face=3DArial =
for j =3D i + 1 to length(x)=20
=
do<BR> =
if=20
compare(x[j],x[i]) < 0 then =20
=
-- swap x[j], x[i] =
=20
=20
=
temp =3D x[j] =20
=20
=
I need these ones explained, I've got no idea what they=20
=
; =20
x[j] =3D x[i] =20
-- =
=20
=20
=
bsp; =20
x[i] =3D temp =20
-- =
=20
=20
=
/<BR> =
end=20
if<BR> end for</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT size=3D2><STRONG>The brackets are simply pointing to a =
value in the=20
sequence (or array).</STRONG></FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=3D2><STRONG>If we have a sequence composed of five =
elements,=20
called janitor:</STRONG></FONT></DIV>
<DIV> </DIV>
<DIV><STRONG><FONT size=3D2> janitor =3D { 1 , "B" , =
{ 1 , "CB"=20
} , xray , "plunk" }</FONT></STRONG></DIV>
<DIV> </DIV>
<DIV><FONT size=3D2><STRONG>then element 5, accessed as=20
follows:</STRONG></FONT></DIV>
<DIV><FONT size=3D2><STRONG></STRONG></FONT> </DIV>
<DIV><FONT size=3D2><STRONG> vVar =3D=20
janitor[5]</STRONG></FONT></DIV>
<DIV><FONT size=3D2><STRONG></STRONG></FONT> </DIV>
<DIV><FONT size=3D2><STRONG>vVar would be =
"plunk".</STRONG></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><BR> return =
x =20
=
=20
-- whats return do?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT size=3D2><STRONG>Returns the value to the calling program, =
indicating=20
that the function is done processing.</STRONG></FONT><FONT =
face=3DArial=20
------=_NextPart_000_0056_01C00397.A9E9F100--
|
Not Categorized, Please Help
|
|