1. conditional expressions and more

yea okay basically i'm wondering if there's some way to use sequences
in conditional expressions while avoid that oh-so-annoying
conditional expression must be an atom error...  if you don't know
what i'm talking about, i want to do something like this:

sequence a,b

a = "fred"
b = "bob"

if a = b then
    puts(1,"they are the same\n")
else
    puts(1,"they are not the same\n")
end if

abort(1)

okay so you see i want to compare two sequences without going through
some sort of costly looping routines and that...  oh and one other
thing...  does someone want to double check me on whether the vga
bios stores pixel information starting at offset #A0000...  uhhh yea
so thanks :>


 ...oooO        MikPos of MARTYR        Oooo...
..ooO  http://www.geocities.com/SoHo/9036  Ooo..
   ....oooO       mike burrell      OOooo....

new topic     » topic index » view message » categorize

2. Re: conditional expressions and more

> yea okay basically i'm wondering if there's some way to use sequences
> in conditional expressions while avoid that oh-so-annoying
> conditional expression must be an atom error...  if you don't know
> what i'm talking about, i want to do something like this:

I'm new here, but I'm pretty sure that the answer is to use the compare()
function.  Using your example:

> sequence a,b
>
> a = "fred"
> b = "bob"
>
> if a = b then

change that line to be:

 if compare(a, b) = 0 then
>     puts(1,"they are the same\n")
> else
>     puts(1,"they are not the same\n")
> end if
>
> abort(1)
>

I tested it, and it seems to work...

 __
    Snowgen
     snowgen at wf.net
     http://www.wf.net/~snowgen/

new topic     » goto parent     » topic index » view message » categorize

3. Re: conditional expressions and more

> > if a = b then
>
> change that line to be:
>
>  if compare(a, b) = 0 then
> >     puts(1,"they are the same\n")
> > else
> >     puts(1,"they are not the same\n")
> > end if
> >
> > abort(1)

> I tested it, and it seems to work...

hey wow...  thx a lot :>

 ...oooO        MikPos of MARTYR        Oooo...
..ooO  http://www.geocities.com/SoHo/9036  Ooo..
   ....oooO       mike burrell      OOooo....

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu