1. atoms, grrrrrr
Can someone explain this to me:
code:
sequence s1
integer at1
if at1 < length( s1 )
data:
s1 = {{116't',104'h',101'e'},{99'c',97'a',116't'},{97'a',116't',101'e'},
at1 = 3
error:
true/false condition must be an ATOM
me:
Kat
2. Re: atoms, grrrrrr
You never assigned a value to at1 before you
asked it whether it was less than another value
Euman
----- Original Message -----
From: "Kat" <gertie at PELL.NET>
To: "EUforum" <EUforum at topica.com>
Sent: Wednesday, February 21, 2001 14:05
Subject: atoms, grrrrrr
| Can someone explain this to me:
|
| code:
| sequence s1
| integer at1
|
| if at1 < length( s1 )
|
| data:
| s1 = {{116't',104'h',101'e'},{99'c',97'a',116't'},{97'a',116't',101'e'},
| {98'b',105'i',103'g'},{100'd',105'i',110'n',110'n',101'e',114'r'}}
|
| at1 = 3
|
| error:
| true/false condition must be an ATOM
|
|
| me:
| Kat
|
|
|
3. Re: atoms, grrrrrr
Is an integer an atom?
----- Original Message -----
From: Kat <gertie at PELL.NET>
To: EUforum <EUforum at topica.com>
Sent: Wednesday, February 21, 2001 11:05 AM
Subject: atoms, grrrrrr
> Can someone explain this to me:
>
> code:
> sequence s1
> integer at1
>
> if at1 < length( s1 )
>
> data:
> s1 = {{116't',104'h',101'e'},{99'c',97'a',116't'},{97'a',116't',101'e'},
> {98'b',105'i',103'g'},{100'd',105'i',110'n',110'n',101'e',114'r'}}
>
> at1 = 3
>
> error:
> true/false condition must be an ATOM
>
>
> me:
> Kat
>
>
>
4. Re: atoms, grrrrrr
On 21 Feb 2001, at 11:49, Euman wrote:
> You never assigned a value to at1 before you
> asked it whether it was less than another value
Peoples, i did provide the values, as printed out in ex.err, they had values.
On 21 Feb 2001, at 13:40, Ted Fines wrote:
> The following code works, and should output a 5 and then a 3, if the
> variables are left unchanged. misc.e is included for the sleep() function.
>
> length(s) gets evaluated twice in the code and both times works. Even if
> you set s="", it still functions properly.
>
> If I were you, I'd add these four lines before my comparison of the integer
> and length(s)...
> puts(1,sprintf("%d\n",length(s)))
> for c=1 to length(s) do
> puts(1,"s[" & sprintf("%d",c) & "]=" & s[c] & "\n")
> end for
> ...just so you can see if s is what you think it is.
And it is what i thought it is, as i assigned them and as printed out in ex.err.
On 21 Feb 2001, at 11:49, Brian Broker wrote:
> Kat,
>
> You have not provided enough info... Perhaps you could send a snippet
> of actual code that produces the same error. The following program
> works great:
I did, it's:
if at1 < length( s1 )
> sequence s1
> integer at1
>
> -- first define at1, and s1
> at1 = 3
> -- data:
> --s1={116't',104'h',101'e'},{99'c',97'a',116't'}{97'a',116't',101'e'},
> --{98'b',105'i',103'g'},{100'd',105'i',110'n',110'n',101'e',114'r'}}
> s1 = { "the", "cat", "ate", "big", "dinner" }
That is how i defined it, the line just above is what ex.err printed out, which
is the
same thing and correct, right?
>
> if at1 < length( s1 ) then
> puts( 1, "at1 < length(s1)" )
> else
> puts( 1, "at1 > length(s1)" )
> end if
So why is the code you wrote, which is exactly the code i put into this other
program,
working by itself, and not in the program? The boolean test line is the same,
and the
vars are the same.
Kat
5. Re: atoms, grrrrrr
- Posted by abindoff at ONE.NET.AU
Feb 21, 2001
>tracer window says it is:
>s1 = {{116't',104'h',101'e'},{99'c',97'a',116't'},{97'a',116't',101'e'},
>which is correct, as it should be.
>
>? length(s1)
>will print out: 3
I'm sure that's just a typo, wouldn't it be 5?
Regards,
Aidan