1. sequence

This is a multi-part message in MIME format.

------=_NextPart_000_0020_01C206C7.B2C72790
	charset="iso-8859-2"

This is strange:
   =20
    sequence s
    s =3D {1,2,3,4,5,6,7,8,9}
    s [2..4] =3D 99
    ?s

instead of displaying {1,99,5,6,7,8,9}
it displays {1,99,99,99,5,6,7,8,9}

it would be more logical if it would do the thing nr 1.


AND:

?routine_id ("power")
why is this -1? this is also not logical.

I know why these two things do what they do but they are not logical, or =
say intiuitive.

------=_NextPart_000_0020_01C206C7.B2C72790
Content-Type: text/html;
	charset="iso-8859-2"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-2">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>This is strange:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; sequence =
s<BR>&nbsp;&nbsp;&nbsp;=20
s =3D {1,2,3,4,5,6,7,8,9}<BR>&nbsp;&nbsp;&nbsp; s [2..4] =3D=20
99<BR>&nbsp;&nbsp;&nbsp; ?s</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>instead of displaying =
{1,99,5,6,7,8,9}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>it displays =
{1,99,99,99,5,6,7,8,9}<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>it would be more logical if it would do =
the thing=20
nr 1.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial><FONT size=3D2></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial><FONT size=3D2>AND:</FONT></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial><FONT size=3D2>?routine_id =
("power")</FONT></FONT></DIV>
<DIV><FONT face=3DArial>
<DIV><FONT face=3DArial><FONT size=3D2>why is this -1? this is also not=20
logical.</FONT></FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>I know why these two things do what they do but they =
are not=20

------=_NextPart_000_0020_01C206C7.B2C72790--

new topic     » topic index » view message » categorize

2. Re: sequence

Tone,

You ASK Euphoria to change sequence [2,3 and 4] to be set to 99=
 if you do it this way

Antoine

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

3. Re: sequence

Hi Derek,

<snip>
> ------ Derek Replies: -----------
> I was surprised when I first came across the syntax : <SLICE> = <ATOM> : I
> actually thought it wouldn't work 'cos I had been brainwashed into thinking
> that when a target is a SLICE, the source had to be the same length. But
> then I realised that an atom has no length and the syntax is analogous to
> <SLICE> += <ATOM>. That is, each element in the SLICE is effected by the
> atom value. Once I started to think that way, it became "intuitive" blink

> I'm not sure if you know the technique for getting the effect of a
> routine_id for a built-in function, but here is one way to do it...
<snip>

this was not the first time, that your mail was not just an answer to
the asked question, but a small "lesson". As a beginner with Euphoria,
I collect this mails, and so I get a growing tutorial. smile

I just want to thank you for your comprehensive information.

Best regards,
   Juergen

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

4. Re: sequence

>------------
> function BIpower(object x, object y)
>    return power(x,y)
> end function
> without warning
> function power(object x, object y)
>     return BIpower(x,y)
> end function
> with warning
> 
> constant r = routine_id("power")
>--------------
>
>Of course, it would be a lot more simple (for us users of the product) to
>allow taking the routine_id of a built_in function/procedure. However, I
>realise that the internal architecture of Euphoria actually makes this a
>non-trivial exercise.
>
>----------
>Derek.

Why not making internal.e which would come with standard EU, containing, 
"wrappers" to internal functions/procedures with some prefix in name, like:

---- internal.e ----
global function _power(object x, objext y)
    return power(x, y)
end function

...
---- end of internal.e ----

This way, you can still use power to refere internal function, and have only one
auxiliary function-call when you use call(routine_id("_power"), {x, y})

Alexa

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

5. Re: sequence

Good idea Alexa. I'll write one up and post it to this list soon.

jbrown

On  0, alexione at EUnet.yu wrote:
> 
> >------------
> > function BIpower(object x, object y)
> >    return power(x,y)
> > end function
> > without warning
> > function power(object x, object y)
> >     return BIpower(x,y)
> > end function
> > with warning
> > 
> > constant r = routine_id("power")
> >--------------
> >
> >Of course, it would be a lot more simple (for us users of the product) to
> >allow taking the routine_id of a built_in function/procedure. However, I
> >realise that the internal architecture of Euphoria actually makes this a
> >non-trivial exercise.
> >
> >----------
> >Derek.
> 
> Why not making internal.e which would come with standard EU, containing, 
> "wrappers" to internal functions/procedures with some prefix in name, like:
> 
> ---- internal.e ----
> global function _power(object x, objext y)
>     return power(x, y)
> end function
> 
> ...
> ---- end of internal.e ----
> 
> This way, you can still use power to refere internal function, and have only
> one
> auxiliary function-call when you use call(routine_id("_power"), {x, y})
> 
> Alexa
> 



-- 
http://fastmail.fm/ - Consolidate POP email and HotMail in one place

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

Search



Quick Links

User menu

Not signed in.

Misc Menu