Re: Euphoria 2.5 Features..... ??

new topic     » goto parent     » topic index » view thread      » older message » newer message

----- Original Message ----- 
From: "Derek Parnell" <ddparnell at bigpond.com>
To: <EUforum at topica.com>
Subject: Re: Euphoria 2.5 Features..... ??


    <SNIP by Unkmar>
>   sequence of integer Scores
>
> which would cause Euphoria to ensure that only integers were stored in the
sequence.
    <SNIP by Unkmar>
> Derek
>

global type seq_of_int(object x)
  sequence mask

  if atom(x) then
    return 0 -- an atom isn't a sequence
  else
    mask = repeat(0, length(x))
    if compare(mask, (x*0) then
      return 0 -- a sequence must be embedded.
    elsif compare(x, floor(x)) then
       return 0 -- a float is somewhere in the sequence
    else
      mask = (-1073741824 > x) or (x > 1073741823)
      return find(1, x) -- if 1 is found then outsite integer range
    end if
  end if
end type

        Lucius L. Hilley III - Unkmar

PS: This doesn't mean I am against a built in system.
In fact.  I'm for one.
I don't like the above becuse it has a horrible speed penalty.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu