Re: Find 3: The Reckoning
------=_NextPart_000_000B_01C04352.1E3BF900
boundary="----=_NextPart_001_000C_01C04352.1E3BF900"
------=_NextPart_001_000C_01C04352.1E3BF900
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
----- Original Message -----=20
From: Derek Parnell=20
To: EUPHORIA at LISTSERV.MUOHIO.EDU=20
Sent: Sunday, October 29, 2000 10:42 AM
Subject: Re: Find 3: The Reckoning
Ok Thomas, I'll bite.
=20
------
Derek Parnell
Melbourne, Australia
(Vote [1] The Cheshire Cat for Internet Mascot)
=20
include get.e
sequence names,curname
object input
integer location
atom wn
wn=3Drand(3)
names =3D{"bob","them","worms"}
curname=3Dnames[wn]
printf(1,"curname: %s\n",{curname})
=20
input=3Dgets(0)
? curname
puts(1,"\n")
? input
location =3D find(input[1],names[2])
This previous line is saying "Find where the first character of input =
inside of the second sequence of names". Is this what you are really =
trying to find out?
I suspect you are trying to find out if "input" is one of the three =
possible names. If that is so, try this instead...
if sequence(input) then
-- Strip off the trailing newline char.
input =3D input[1 .. length(input) - 1]
-- convert to lowercase.
input =3D lower(input)
-- See if the input sequence is one of the sequences in names.
location =3D find(input, names)
-- "location" should equal 0, 1, 2, or 3 now.
else
-- End-Of-File (Ctrl-Z) entered.
location =3D 0
end if =20
=20
=20
puts(1,"\n")
? location
=20
=20
The "location" variable only gives a correct number if "them" is =
used.=20
And what is the correct number? What were you expecting to see?
Nothing else. I've looked at all the documentation I've got and =
either I am quite blind or, I just haven't found my solution. Anywho, if =
you could solve this problem, I'd be most grateful....
=20
I suspect you are confused by the find() function. It takes two =
parameters, the first can be an atom or a sequence but the second must =
be a sequence. It then scans each element in the second parameter to see =
if it equals the first parameter. If so, it returns the number of the =
element in the second parmeter that equalled the first parameter.
=20
This means that if the first parameter is a sequence, as is your case =
here, then each of the elements in the second parmeter should be =
sequences too. Also, this is what you have coded for names. However, in =
your coding of find() you used input[1] which is not a sequence but the =
first character of input. It is a single character - an atom. Also, you =
coded the second parameter as names[2] which is a sequence if characters =
- namely "them" . Thus, find() went looking through the characters ''t', =
'h', 'e', and 'm' to see if the first character of input equalled any.
=20
This would mean that location would be non-zero, 1 to 4, for any input =
that begun with 't', 'h', 'e', or 'm'.
=20
Das Svendanya
Thomas
PS. This should be the last one.........
Yeah, sure Thomas. --------I meant the last one on this program, but, =
you're right
What I'm trying to do here is get the placement of an individual =
letter from a word. So if the word is "moor" and the user types in =
'o'.....wait, bad example, there are two o's....would eusphoria see that =
as [2..3]?
okay, if the user types in 'r', whatever variable I assigned find() to =
will be 4.
-Hope this clarifies things.....
-HAPPY HALLOWEEN!!!
-Thomas
PS. How'd you like the Halloween-esque sound?
------=_NextPart_001_000C_01C04352.1E3BF900
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.2614.3500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff><BGSOUND balance=3D0=20
src=3D"cid:000a01c04395$2bf15c00$0100007f@kerslake" volume=3D0>
<DIV> </DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: =
0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">
<DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV=20
style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: =
black"><B>From:</B>=20
<A href=3D"mailto:dparnell at BIGPOND.NET.AU" =
title=3Ddparnell at BIGPOND.NET.AU>Derek=20
Parnell</A> </DIV>
<DIV style=3D"FONT: 10pt arial"><B>To:</B> <A=20
href=3D"mailto:EUPHORIA at LISTSERV.MUOHIO.EDU"=20
title=3DEUPHORIA at LISTSERV.MUOHIO.EDU>EUPHORIA at LISTSERV.MUOHIO.EDU</A> =
</DIV>
<DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Sunday, October 29, 2000 =
10:42=20
AM</DIV>
<DIV style=3D"FONT: 10pt arial"><B>Subject:</B> Re: Find 3: The =
Reckoning</DIV>
<DIV><BR></DIV>
<DIV dir=3Dltr style=3D"FONT: 10pt arial"><FONT face=3DArial =
size=3D2>Ok Thomas, I'll=20
bite.</FONT></DIV>
<DIV dir=3Dltr style=3D"FONT: 10pt arial"><FONT face=3DArial=20
size=3D2></FONT> </DIV>
<DIV dir=3Dltr style=3D"FONT: 10pt arial">------<BR>Derek =
Parnell<BR>Melbourne,=20
Australia<BR>(Vote [1] The Cheshire Cat for Internet Mascot)<BR></DIV>
<BLOCKQUOTE dir=3Dltr=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></FONT> </DIV>
<DIV><FONT color=3D#000080 face=3DArial size=3D2>include =
get.e<BR>sequence=20
names,curname<BR>object input<BR>integer location<BR>atom=20
wn<BR>wn=3Drand(3)<BR>names=20
=
%s\n",{curname})</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000080 face=3DArial =
size=3D2>input=3Dgets(0)<BR>?=20
curname<BR>puts(1,"\n")<BR>? input</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>
<DIV><FONT color=3D#000080 face=3DArial size=3D2>location =3D=20
find(input[1],names[2])</FONT></DIV></FONT></DIV></BLOCKQUOTE>
<DIV dir=3Dltr><FONT face=3DArial size=3D2>This previous line is =
saying "Find=20
where the first character of input inside of the second sequence of=20
names". Is this what you are really trying to find =
out?</FONT></DIV>
<DIV dir=3Dltr><FONT face=3DArial size=3D2>I suspect you are trying to =
find out if=20
"input" is one of the three possible names. If that is so, try this=20
instead...</FONT></DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px">
<DIV dir=3Dltr><STRONG><FONT size=3D2>if sequence(input)=20
then</FONT></STRONG></DIV>
<DIV dir=3Dltr><STRONG><FONT size=3D2> -- Strip =
off the=20
trailing newline char.</FONT></STRONG></DIV>
<DIV dir=3Dltr><STRONG><FONT size=3D2> input =3D =
input[1 ..=20
length(input) - 1]</FONT></STRONG></DIV>
<DIV dir=3Dltr><STRONG><FONT size=3D2> -- convert =
to=20
lowercase.</FONT></STRONG></DIV>
<DIV dir=3Dltr><STRONG><FONT size=3D2> input =3D=20
lower(input)</FONT></STRONG></DIV>
<DIV dir=3Dltr><STRONG><FONT size=3D2> -- See if =
the input=20
sequence is one of the sequences in names.</FONT></STRONG></DIV>
<DIV dir=3Dltr><STRONG><FONT size=3D2> location =
=3D find(input,=20
names)</FONT></STRONG></DIV>
<DIV dir=3Dltr><STRONG><FONT size=3D2> -- =
"location" should=20
equal 0, 1, 2, or 3 now.</FONT></STRONG></DIV>
<DIV dir=3Dltr><STRONG><FONT size=3D2>else</FONT></STRONG></DIV>
<DIV dir=3Dltr><STRONG><FONT size=3D2> -- =
End-Of-File (Ctrl-Z)=20
entered.</FONT></STRONG></DIV>
<DIV dir=3Dltr><FONT size=3D2><STRONG> location =
=3D=20
0</STRONG></FONT></DIV>
<DIV dir=3Dltr><FONT size=3D2><STRONG>end if</STRONG><FONT=20
face=3DArial> =
</FONT></FONT></DIV>
<DIV dir=3Dltr><STRONG><FONT =
<BLOCKQUOTE dir=3Dltr=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></FONT> </DIV>
<DIV><FONT color=3D#000080 face=3DArial size=3D2>puts(1,"\n")<BR>?=20
location</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> The "location" =
variable only=20
gives a correct number if "them" is used. </FONT></DIV></BLOCKQUOTE>
<DIV dir=3Dltr><FONT face=3DArial size=3D2>And what is the =
<STRONG>correct</STRONG>=20
number? What were you expecting to see?</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=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>Nothing else. I've looked at all =
the=20
documentation I've got and either I am quite blind or, I just =
haven't found=20
my solution. Anywho, if you could solve this problem, I'd be most=20
grateful....</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV></BLOCKQUOTE>
<DIV dir=3Dltr><FONT face=3DArial size=3D2>I suspect you are confused =
by=20
the <STRONG>find()</STRONG> function. It takes two parameters, =
the first=20
can be an atom or a sequence but the second must be a sequence. It =
then scans=20
each element in the second parameter to see if it equals the first =
parameter.=20
If so, it returns the number of the element in the second parmeter =
that=20
equalled the first parameter.</FONT></DIV>
<DIV dir=3Dltr><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV dir=3Dltr><FONT face=3DArial size=3D2>This means that if the =
first parameter is=20
a sequence, as is your case here, then each of the elements in the =
second=20
parmeter should be sequences too. Also, this is what you have coded =
for=20
<EM>names</EM>. However, in your coding of <STRONG>find()</STRONG> you =
used=20
<EM>input[1]</EM> which is <STRONG>not</STRONG> a sequence but the =
first=20
character of input. It is a single character - an atom. Also, you =
coded=20
the second parameter as <EM>names[2]</EM> which is a sequence if =
characters -=20
namely <EM>"them"</EM> . Thus, <STRONG>find()</STRONG> went looking =
through=20
the characters ''t', 'h', 'e', and 'm' to see if the first character =
of=20
<EM>input</EM> equalled any.</FONT></DIV>
<DIV dir=3Dltr><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV dir=3Dltr><FONT face=3DArial size=3D2>This would mean that =
<EM>location</EM>=20
would be non-zero, 1 to 4, for any input that begun with 't', =
'h', 'e',=20
or 'm'.</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=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></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Das Svendanya</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Thomas</FONT></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>PS. This <EM>should</EM> be =
the last=20
one.........</FONT></DIV></BLOCKQUOTE>
<DIV dir=3Dltr><FONT face=3DArial size=3D2>Yeah, sure Thomas. =
--------I meant=20
the last one on this program, but, you're right
</FONT></DIV>
<DIV dir=3Dltr> </DIV>
<DIV dir=3Dltr><FONT face=3DArial size=3D2>What I'm trying to do here =
is get the=20
placement of an individual letter from a word. So if the word is =
"moor" and=20
the user types in 'o'.....wait, bad example, there are two =
o's....would=20
eusphoria see that as [2..3]?</FONT></DIV>
<DIV dir=3Dltr> </DIV>
<DIV dir=3Dltr><FONT face=3DArial size=3D2>okay, if the user types in =
'r', whatever=20
variable I assigned find() to will be 4.</FONT></DIV>
<DIV dir=3Dltr> </DIV>
<DIV dir=3Dltr><FONT face=3DArial size=3D2>-Hope this clarifies=20
things.....</FONT></DIV>
<DIV dir=3Dltr><FONT face=3DArial size=3D6>-H<FONT =
color=3D#ff8000>A</FONT>P<FONT=20
color=3D#ff8000>P</FONT>Y <FONT color=3D#ff8000>H</FONT>A<FONT=20
color=3D#ff8000>L</FONT>L<FONT color=3D#ff8000>O</FONT>W<FONT=20
color=3D#ff8000>E</FONT>E<FONT color=3D#ff8000>N</FONT>!<FONT=20
color=3D#ff8000>!</FONT>!</FONT></DIV>
<DIV dir=3Dltr><FONT face=3DArial size=3D2>-Thomas</FONT></DIV>
<DIV dir=3Dltr> </DIV>
<DIV dir=3Dltr><FONT face=3DArial size=3D2>PS. How'd you like the =
Halloween-esque=20
sound?</FONT><FONT face=3DArial=20
------=_NextPart_001_000C_01C04352.1E3BF900--
------=_NextPart_000_000B_01C04352.1E3BF900
name="Guillotn.wav"
|
Not Categorized, Please Help
|
|