Re: Find 3: The Reckoning
------=_NextPart_000_001D_01C0438F.256F2840
boundary="----=_NextPart_001_001E_01C0438F.256F2840"
------=_NextPart_001_001E_01C0438F.256F2840
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Just kidding....
Happy Halloween....
----- Original Message -----=20
From: Liona Kerslake=20
To: EUPHORIA at LISTSERV.MUOHIO.EDU=20
Sent: Tuesday, October 31, 2000 6:49 PM
Subject: Re: Find 3: The Reckoning
----- 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.
------
Derek Parnell
Melbourne, Australia
(Vote [1] The Cheshire Cat for Internet Mascot)
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})
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
puts(1,"\n")
? location
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....
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.
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.
This would mean that location would be non-zero, 1 to 4, for any =
input that begun with 't', 'h', 'e', or 'm'.
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_001E_01C0438F.256F2840
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4207.2601" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Just kidding....</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Happy Halloween....</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-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 title=3Dpaulk at UNISERVE.COM href=3D"mailto:paulk at UNISERVE.COM">Liona =
Kerslake</A> </DIV>
<DIV style=3D"FONT: 10pt arial"><B>To:</B> <A =
title=3DEUPHORIA at LISTSERV.MUOHIO.EDU=20
=
</A>=20
</DIV>
<DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Tuesday, October 31, 2000 =
6:49=20
PM</DIV>
<DIV style=3D"FONT: 10pt arial"><B>Subject:</B> Re: Find 3: The =
Reckoning</DIV>
<DIV><BR></DIV><BGSOUND balance=3D0=20
src=3D"cid:001c01c043b9$0e09ade0$37b04cd8@euman" volume=3D0>
<DIV> </DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-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 title=3Ddparnell at BIGPOND.NET.AU =
href=3D"mailto:dparnell at BIGPOND.NET.AU">Derek=20
Parnell</A> </DIV>
<DIV style=3D"FONT: 10pt arial"><B>To:</B> <A=20
title=3DEUPHORIA at LISTSERV.MUOHIO.EDU=20
=
</A>=20
</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=20
Reckoning</DIV>
<DIV><BR></DIV>
<DIV dir=3Dltr style=3D"FONT: 10pt arial"><FONT face=3DArial =
size=3D2>Ok Thomas,=20
I'll 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"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#000080 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 face=3DArial color=3D#000080 =
size=3D2>input=3Dgets(0)<BR>?=20
curname<BR>puts(1,"\n")<BR>? input</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>
<DIV><FONT face=3DArial color=3D#000080 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 =
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=20
find(input, 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=20
(Ctrl-Z) 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"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#000080 size=3D2>puts(1,"\n")<BR>? =
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=20
only gives a correct number if "them" is used. =
</FONT></DIV></BLOCKQUOTE>
<DIV dir=3Dltr><FONT face=3DArial size=3D2>And what is the=20
<STRONG>correct</STRONG> number? What were you expecting to=20
see?</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-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=20
found 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=20
first can be an atom or a sequence but the second must be a =
sequence. It=20
then scans each element in the second parameter to see if it equals =
the=20
first parameter. If so, it returns the number of the element in the =
second=20
parmeter that 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=20
is 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=20
through the characters ''t', 'h', 'e', and 'm' to see if the first =
character=20
of <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"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-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',=20
whatever 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_001E_01C0438F.256F2840--
------=_NextPart_000_001D_01C0438F.256F2840
name="Guillotn.wav"
|
Not Categorized, Please Help
|
|