1. get()

------=_NextPart_000_0005_01C00AF9.E0D67760
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

include get.e

object input=20
atom value1, value2, value3, average, error_code          --why so =
complex example??????
sequence name

error_code =3D 999             --does it have to be an error code? What =
is 999?
    =20
puts(1,"Hello! Enter your first name in quotes below, like \"John\":\n")

while error_code !=3D 0 do
     input =3D get(0)
     error_code =3D input[1]        --What is this??? What is [1]
end while

name =3D input[2]        --What is this?? what is [2]

puts(1, "\nThank you! Now please enter any three numeric values =
below,\n")
puts(1, "and you will see both your name and the average of the =
three\n")
puts(1, "numbers you entered. Separate the numbers with the space =
bar:\n")

error_code =3D 999             --Same confusion with this!!! HELP!!
while error_code !=3D 0 do
     input =3D get(0)
     error_code =3D input[1]
end while
puts(1, "\nGot first number!\n")
value1 =3D input[2]=20

error_code =3D 999=20
while error_code !=3D 0 do
     input =3D get(0)
     error_code =3D input[1]
end while
puts(1, "\nGot second number!\n")
value2 =3D input[2]=20

error_code =3D 999=20
while error_code !=3D 0 do
     input =3D get(0)
     error_code =3D input[1]
end while
puts(1, "\nGot third number!\n")
value3 =3D input[2]=20

average =3D (value1+value2+value3)/3
printf(1,"\nHello, %s, your computed average is %4.2f\n",{name, =
average})


------=_NextPart_000_0005_01C00AF9.E0D67760
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2920.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>include get.e</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>object input <BR>atom value1, value2, =
value3,=20
average,=20
hy so=20
complex example??????<BR>sequence name</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>error_code =3D 999 &nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; --does it have to&nbsp;be an error =

code?&nbsp;What is 999?<BR>&nbsp;&nbsp;&nbsp;&nbsp; <BR>puts(1,"Hello! =
Enter=20
your first name in quotes below, like \"John\":\n")</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>while error_code !=3D 0=20
do<BR>&nbsp;&nbsp;&nbsp;&nbsp; input =3D =
get(0)<BR>&nbsp;&nbsp;&nbsp;&nbsp;=20
error_code =3D input[1]&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; --What is =
this???=20
What is [1]<BR>end while</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>name =3D input[2]&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; --What is this?? what is [2]</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>puts(1, "\nThank you! Now please enter =
any three=20
numeric values below,\n")<BR>puts(1, "and you will see both your name =
and the=20
average of the three\n")<BR>puts(1, "numbers you entered. Separate the =
numbers=20
with the space bar:\n")</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>error_code =3D 999 &nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; --Same confusion with this!!!=20
HELP!!<BR>while error_code !=3D 0 do<BR>&nbsp;&nbsp;&nbsp;&nbsp; input =
=3D=20
get(0)<BR>&nbsp;&nbsp;&nbsp;&nbsp; error_code =3D input[1]<BR>end =
while<BR>puts(1,=20
"\nGot first number!\n")<BR>value1 =3D input[2] </FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>error_code =3D 999 <BR>while error_code =
!=3D 0=20
do<BR>&nbsp;&nbsp;&nbsp;&nbsp; input =3D =
get(0)<BR>&nbsp;&nbsp;&nbsp;&nbsp;=20
error_code =3D input[1]<BR>end while<BR>puts(1, "\nGot second=20
number!\n")<BR>value2 =3D input[2] </FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>error_code =3D 999 <BR>while error_code =
!=3D 0=20
do<BR>&nbsp;&nbsp;&nbsp;&nbsp; input =3D =
get(0)<BR>&nbsp;&nbsp;&nbsp;&nbsp;=20
error_code =3D input[1]<BR>end while<BR>puts(1, "\nGot third =
number!\n")<BR>value3=20
=3D input[2] </FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>average =3D=20
(value1+value2+value3)/3<BR>printf(1,"\nHello, %s, your computed average =
is=20

------=_NextPart_000_0005_01C00AF9.E0D67760--

new topic     » topic index » view message » categorize

2. Re: get()

------=_NextPart_000_0025_01C00AAA.D642E440
        charset="iso-8859-1"

Asif, you need to RTFM (read the friendly manual)...
  include get.e

  object input
  atom value1, value2, value3, average, error_code          --why so complex
example??????

  This is just establishing that the variables named above will hold atom
values... not complex at all!

  [snip snip]

   while error_code != 0 do
       input = get(0)
       error_code = input[1]        --What is this??? What is [1]
  end while

  You can figure this out by reading the information on get().
  name = input[2]        --What is this?? what is [2]

  Simple sequence subscripting. The code is setting the variable "name" to
equal the second element of the sequence "input". RTFM regarding sequences.

------=_NextPart_000_0025_01C00AAA.D642E440
        charset="iso-8859-1"
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-1">
<META content=3D"MSHTML 5.50.4207.2601" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><SPAN class=3D330582718-20082000><FONT face=3DArial color=3D#0000ff =
size=3D2>Asif,=20
you need to RTFM (read the friendly manual)...</FONT></SPAN></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px =
solid; MARGIN-RIGHT: 0px">
  <DIV class=3DOutlookMessageHeader dir=3Dltr align=3Dleft><FONT =
face=3DArial=20
  size=3D2>include get.e</FONT></DIV>
  <DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>object input <BR>atom value1, value2, =
value3,=20
  average,=20
  =
hy so=20
  complex example??????<SPAN class=3D330582718-20082000><FONT=20
  color=3D#0000ff>&nbsp;</FONT></SPAN></FONT></DIV>
  <DIV><FONT face=3DArial size=3D2><SPAN=20
  class=3D330582718-20082000></SPAN></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2><SPAN =
class=3D330582718-20082000><STRONG>This is=20
  just establishing that the variables named above will hold atom =
values... not=20
  complex at all!</STRONG></SPAN></FONT></DIV>
  <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
  class=3D330582718-20082000>&nbsp;</SPAN></FONT></DIV>
  <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
  class=3D330582718-20082000><STRONG>[snip =
snip]</STRONG></SPAN></FONT></DIV>
  <DIV><SPAN class=3D330582718-20082000></SPAN><FONT face=3DArial><FONT =
size=3D2><SPAN=20
  class=3D330582718-20082000><FONT=20
  color=3D#0000ff>&nbsp;</FONT></SPAN></FONT></FONT></DIV>
  <DIV><FONT face=3DArial><FONT size=3D2><SPAN=20
  class=3D330582718-20082000>&nbsp;</SPAN>while error_code !=3D 0=20
  do<BR>&nbsp;&nbsp;&nbsp;&nbsp; input =3D =
get(0)<BR>&nbsp;&nbsp;&nbsp;&nbsp;=20
  error_code =3D input[1]&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; --What is =
this???=20
  What is [1]<BR>end while<SPAN class=3D330582718-20082000><FONT=20
  color=3D#0000ff>&nbsp;</FONT></SPAN></FONT></FONT></DIV>
  <DIV><FONT face=3DArial><FONT size=3D2><SPAN=20
  class=3D330582718-20082000></SPAN></FONT></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial><FONT size=3D2><SPAN=20
  class=3D330582718-20082000><STRONG><FONT color=3D#0000ff>You =
can&nbsp;figure this=20
  out by reading the information on=20
  get().</FONT></STRONG>&nbsp;</SPAN></FONT></FONT></DIV></BLOCKQUOTE>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px =
solid; MARGIN-RIGHT: 0px">
  <DIV><FONT face=3DArial><FONT size=3D2>name =3D =
input[2]&nbsp;&nbsp;&nbsp;=20
  &nbsp;&nbsp;&nbsp; --What is this?? what is [2]<SPAN=20
  class=3D330582718-20082000><FONT=20
  color=3D#0000ff>&nbsp;</FONT></SPAN></FONT></FONT></DIV>
  <DIV><FONT face=3DArial><FONT size=3D2><SPAN=20
  class=3D330582718-20082000></SPAN></FONT></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial><FONT size=3D2><SPAN=20
  class=3D330582718-20082000><STRONG><FONT color=3D#0000ff>Simple =
sequence=20
  subscripting. The code is setting the variable "name" to equal the =
second=20
  element of the sequence "input". RTFM regarding=20
  =
</HTML>

------=_NextPart_000_0025_01C00AAA.D642E440--

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

3. Re: get()

------=_NextPart_000_002B_01C00AAD.10EA89C0
        charset="iso-8859-1"

Looks like my entire reply got munged somehow. DRAT!!!
  -----Original Message-----
  From: Euphoria Programming for MS-DOS
[mailto:EUPHORIA at LISTSERV.MUOHIO.EDU]On Behalf Of ck lester
  Sent: Sunday, August 20, 2000 1:31 PM
  To: EUPHORIA at LISTSERV.MUOHIO.EDU
  Subject: Re: get()


  Asif, you need to RTFM (read the friendly manual)...
    include get.e

    object input
    atom value1, value2, value3, average, error_code          --why so
complex example??????

    This is just establishing that the variables named above will hold atom
values... not complex at all!
     <

------=_NextPart_000_002B_01C00AAD.10EA89C0
        charset="iso-8859-1"
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-1">
<META content=3D"MSHTML 5.50.4207.2601" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><SPAN class=3D780124618-20082000><FONT face=3DArial color=3D#0000ff =
size=3D2>Looks=20
like my entire reply got munged somehow. DRAT!!!</FONT></SPAN></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px =
solid; MARGIN-RIGHT: 0px">
  <DIV class=3DOutlookMessageHeader dir=3Dltr align=3Dleft><FONT =
face=3DTahoma=20
  size=3D2>-----Original Message-----<BR><B>From:</B> Euphoria =
Programming for=20
  MS-DOS [mailto:EUPHORIA at LISTSERV.MUOHIO.EDU]<B>On Behalf Of </B>ck=20
  lester<BR><B>Sent:</B> Sunday, August 20, 2000 1:31 PM<BR><B>To:</B>=20
  EUPHORIA at LISTSERV.MUOHIO.EDU<BR><B>Subject:</B> Re: =
get()<BR><BR></FONT></DIV>
  <DIV><SPAN class=3D330582718-20082000><FONT face=3DArial =
color=3D#0000ff=20
  size=3D2>Asif, you need to RTFM (read the friendly=20
manual)...</FONT></SPAN></DIV>
  <BLOCKQUOTE dir=3Dltr=20
  style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px =
solid; MARGIN-RIGHT: 0px">
    <DIV class=3DOutlookMessageHeader dir=3Dltr align=3Dleft><FONT =
face=3DArial=20
    size=3D2>include get.e</FONT></DIV>
    <DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT>&nbsp;</DIV>
    <DIV><FONT face=3DArial size=3D2>object input <BR>atom value1, =
value2, value3,=20
    average,=20
    =
hy=20
    so complex example??????<SPAN class=3D330582718-20082000><FONT=20
    color=3D#0000ff>&nbsp;</FONT></SPAN></FONT></DIV>
    <DIV><FONT face=3DArial size=3D2><SPAN=20
    class=3D330582718-20082000></SPAN></FONT>&nbsp;</DIV>
    <DIV><FONT face=3DArial size=3D2><SPAN =
class=3D330582718-20082000><STRONG>This is=20
    just establishing that the variables named above will hold atom =
values...=20
    not complex at all!</STRONG></SPAN></FONT></DIV>
    <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
    class=3D330582718-20082000>&nbsp;&lt;=20

------=_NextPart_000_002B_01C00AAD.10EA89C0--

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

4. Re: get()

------=_NextPart_000_0065_01C00B50.08DF1220
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable


    atom value1, value2, value3, average, error_code          --why so =
complex ?
    This is less complex than in C++, it just means that value1 etc are =
atoms, as opposed to sequences, integers and objects.
   =20
    error_code =3D 999             --does it have to be an error code? =
What is 999?
    error_code is just a name - it could just as easily be x.  999 is =
simply a value that isn't 0.  Below it says "while error_code !=3D0" =
which means the program will loop until error_code=3D0. =20
   =20
         error_code =3D input[1]        --What is this??? What is [1]
   =20
    input[1] is element 1 of sequence "input" (e.g  =
input=3D{'a','b','c'}  input[1]=3D'a')
   =20
   =20
    Regards,
    Aidan

------=_NextPart_000_0065_01C00B50.08DF1220
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>

<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 =
Transitional//EN">
<META content=3D'"MSHTML 4.72.3110.7"' name=3DGENERATOR>
<STYLE></STYLE>

</HEAD>
<BODY bgColor=3D#ffffff>
<DIV>&nbsp;</DIV>
<BLOCKQUOTE=20
style=3D"BORDER-LEFT: #000000 solid 2px; MARGIN-LEFT: 5px; PADDING-LEFT: =
5px">
    <DIV><FONT face=3DArial size=3D2>atom value1, value2, value3, =
average,=20
    error_code&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
--why so=20
    complex ?</FONT></DIV>
    <DIV><FONT face=3DArial size=3D2></FONT><EM><FONT size=3D2><FONT=20
    color=3D#000000>This is less complex than in C++, it just means that =
value1=20
    etc are atoms, as opposed to sequences, integers and=20
    objects.</FONT></FONT></EM><FONT color=3D#000000></FONT></DIV>
    <DIV>&nbsp;</DIV>
    <DIV><FONT face=3DArial size=3D2>error_code =3D=20
    =
p;=20
    --does it have to be an error code? What is 999?<BR><EM><FONT=20
    color=3D#000000>error_code is just a name - it could just as easily =
be=20
    x.&nbsp; 999 is simply a value that isn't 0.&nbsp; Below it says =
&quot;while=20
    error_code !=3D0&quot; which means the program will loop until=20
    error_code=3D0.</EM>&nbsp;&nbsp;</FONT></FONT></DIV>
    <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
    <DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp;&nbsp; error_code =
=3D=20
    input[1]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --What is this??? =
What is=20
    [1]<BR></FONT></DIV>
    <DIV><EM><FONT color=3D#000000 size=3D2>input[1] is element 1 of =
sequence=20
    &quot;input&quot; (e.g&nbsp; input=3D{'a','b','c'}&nbsp;=20
    input[1]=3D'a')</FONT></EM></DIV>
    <DIV>&nbsp;</DIV>
    <DIV>&nbsp;</DIV>
    <DIV><FONT color=3D#000000 size=3D2>Regards,</FONT></DIV>
    <DIV><FONT color=3D#000000 =

------=_NextPart_000_0065_01C00B50.08DF1220--

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

5. get()

Back to square one:

-- start of my extremely complex non-win32 prog ----------------------
include get.e
? get(0)
-- end----------------------------------------------------------------

Why, when I feed it garbage, say, 4x, I get {GET_SUCCESS,4}? Jiri

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

6. Re: get()

Jiri Babor writes:

> include get.e
> ? get(0)

> Why, when I feed it garbage, say, 4x, I get {GET_SUCCESS,4}?

That's what I intended it to do. Once it has successfully
read a Euphoria atom or sequence it will return the
value. It doesn't care that the next character in the input is
bogus.

However there is a thorny issue regarding get()
that I might as well mention.

* Warning: tedious detail ahead *

The manual states that you must have at least one
whitespace character between "top-level" objects
in the input stream. This is because get() typically needs to read
one more character beyond the end of an atom, and
it can't "unget" the character properly because you might switch to reading
some other input stream with your next call to get(), making the ungotten
character invalid. Each call to get() must therefore start with a fresh
getc(), ignoring any ungotten character from before.
This problem could be resolved by somehow associating
an ungotten character with every input stream, but I didn't bother to set up
anything like that.

Regards,
     Rob Craig
     Rapid Deployment Software

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

Search



Quick Links

User menu

Not signed in.

Misc Menu