equal() and =

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

----- Original Message -----
From: "irv mullins" <guest at RapidEuphoria.com>
To: <EUforum at topica.com>
Sent: Thursday, June 03, 2004 3:41 PM
Subject: Re: Just say 'YES' to strings (or not?)


>
>
> posted by: irv mullins <irvm at ellijay.com>
>
<snip>
>
> Where it would 'cost' (in a negative sense) would be in the 75% savings
> when storing text. To be able to process roughly 4x as much data in memory
> would be a big plus to some people.

I Agree and like this
>
> Then it would also be possible to reduce the number of functions needed to
> output stuff, resulting in a shorter learning curve, fewer errors, simpler
> programming.

I don't see this being true.  Enlighten me.
>
> We'd also be able to use the = sign in a logical manner for comparing
stringsm
> and ditch that stupid equal().
> When was the last time you wanted to compare two strings and get back a
> sequence of ones and zeros?  Is there any reason you could not get that
> result by writing a simple loop, in the rare event you really needed it?

bmp = load_bitmap("my.bmp")
--errors not checked
pal = bmp[1]
bmp = bmp[2]

--Swap 8's with 128's
mask8 = (bmp = 8)
mask128 = (bmp = 128)
bmp -= mask8 *8 --0's the 8's
bmp -= mask128 * 128--0's the 128's

bmp += mask8 * 128 --adds the 128's where the 8's where
bmp += mask128 * 8 --adds the 8 where the 128's where


NO, that isn't used.  but how about this one.  Transparency.
Let's assume that 0 is the transparent color.
bg = background_area
bmp = transparency_bmp

mask = (bmp = 0)
mask *= bg
mask += bmp
display_image({0,0}, mask)


OR maybe this.
function find_all(sequence s, object x)
  sequence result, mask
  integer f

  mask = (s = x)
  result = {}
  f = find(1, mask)
  while (f) do
    result &= f
    mask[f] = 0
    f = find(1, mask)
  end while

  return result
end function

data = "Contents of a 2 meg file"
answer = find_all(data, 0)
-- If anyone finds this function useful.
-- Simply state it here.
-- I want your votes as PROOF of argument to keep = as it is.


PS: I don't like equal() anymore than the next guy.
  But, I'm one of those what was happy enough with compare()

    unkmar

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

Search



Quick Links

User menu

Not signed in.

Misc Menu