Re: Find 3: The Reckoning
Then why did you send it back for the rest of us to download again???
On 31 Oct 2000, at 23:02, Euman wrote:
> I dont like it!!!!
>
> PLEASE dont make us download extra bytes
> to play sounds......
>
> Thanks:
> euman at bellsouth.net
>
> ----- Original Message -----
> From: Liona Kerslake
> To: EUPHORIA at LISTSERV.MUOHIO.EDU
> Sent: Tuesday, October 31, 2000 6:49 PM
> Subject: Re: Find 3: The Reckoning
>
>
>
> ----- Original Message -----
> From: Derek Parnell
> To: EUPHORIA at LISTSERV.MUOHIO.EDU
> 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=rand(3)
> names ={"bob","them","worms"}
> curname=names[wn]
> printf(1,"curname: %s\n",{curname})
>
> input=gets(0)
> ? curname
> puts(1,"\n")
> ? input
> location = 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 = input[1 .. length(input) - 1]
> -- convert to lowercase.
> input = lower(input)
> -- See if the input sequence is one of the sequences in names.
> location = find(input, names)
> -- "location" should equal 0, 1, 2, or 3 now.
> else
> -- End-Of-File (Ctrl-Z) entered.
> location = 0
> end if
>
>
> puts(1,"\n")
> ? location
>
>
> The "location" variable only gives a correct number if "them" is
> used.
> 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?
>
>
|
Not Categorized, Please Help
|
|