1. Re: we need official libs : Swap

> ---------------------- Information from the mail
header -----------------------
> Poster:       Ralf Nieuwenhuijsen <nieuwen at XS4ALL.NL>
> Subject:      Re: we need official libs : Swap
> --------------------------------------------------------------------------
-----
>
> {x, y} = location ()
>
> object temp
> temp = my_func ()
> s[i] = temp[1]
> s[j] = temp[2]
>

--    I want y and only y.

{y, y} = location()

TRANSLATION:
    temp = location()
    y = temp[1]
    y = temp[2]

--    I want x and only x.

--sequence length's must match.  Very Euphoric !!!
{x, y} = location()--undesired y must be used.

TRANSLATION:
    temp = location()
    x = temp[1]
    y = temp[2]


--sequence length's aren't forced to match
{x} = location()--Extra sequence values are just
                --(dropped, ignored, void, or sent to null).

TRANSLATION:
    temp = location()
    x = temp[1]
    dropped_ignored_void_null = temp[2]
  OR
    temp = location()
    x = temp[1]

   Sorta nicer but doesn't fit well with the Euphoria paradigm.

Personally, I want the this and I don't care if it becomes.
  {x, junk} = location()
OR
  {x} = location()

Either is perfectly acceptable to me.
I also feel that.
  i = 1
  j = 1
  {s[i], s[j]} = {3, 4}
means
  s[1] = 3
  s[1] = 4

Oh, and about this:
{s[2..3], s[1]} = {1, 2, 3}--Error mismatch sequence.
Should use
s[2..3] & s[3] = {1, 2, 3}-- There is your swap AND
                          -- it is still in sequence form.

31bit integer values are the only time that a sequence
isn't holding a 32bit memory pointer.  This means on the
fly seqeunce building shouldn't be that much trouble to use
with this paradigm.  Only real problem is in reminding the
interpreter that we are still on the LeftHand side of the
"=" operator.

        Lucius L. Hilley III
        lhilley at cdc.net   lucius at ComputerCafeUSA.com
+----------+--------------+--------------+----------+
| Hollow   | ICQ: 9638898 | AIM: LLHIII  | Computer |
|  Horse   +--------------+--------------+  Cafe'   |
| Software | http://www.cdc.net/~lhilley |  USA     |
+----------+-------+---------------------+----------+
                   | http://www.ComputerCafeUSA.com |
                   +--------------------------------+

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu