RE: Live Tutoria?

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

Lynn Kilroy wrote:
> 
> > Here is an example:
> > 
> > }}}
<eucode>
> > include get.e
> > 
> > function Input()
> >     sequence string_in -- a place to store our string
> >     integer key -- the next key in the buffer
> > 
> >     string_in = {} -- empty sequence/string
> >     key = wait_key() -- get the first key
> >     while key != 13 do
> >         puts(1, key) -- echo the key to the screen
> >         string_in &= key -- add the key onto the string
> >         key = wait_key() -- get another key
> >     end while
> > 
> >     return string_in
> > end function
> > 
> > sequence new_string
> > new_string = Input()
> > 
> > puts(1, new_string)
> > </eucode>
{{{

> >
> 
> Sequence is the Euphoria equivilant of the Array, correct?  And it 
> really has no real type, and &= tells Euphoria to place the value of the 
> var on the right of the &= in to the next element in the sequence on the 
> left, correct?

Yes, that is correct. Like C and other related languages (and like at the
machine level) a string is just an array of characters. When I first started with
8-bit BASICs on the Apple-][ and Commodore-64 I didn't realize this.

Yes, &= "appends" the value to the end of a sequence. I probably shouldn't have
used the shortcut, I probably should have used the long version:
string_in = string_in & Key
Same thing, just a shortcut. Again, a shortcuts like this are a useful relic
from C.

> 
> So I added it with some little tidbits and ended up with a dump.
> 
> }}}
<eucode>
> D:\LEKSSOFT\EUPHORIA\SOURCE\LEARNING\..\..\include\clrlcte.e:4 in 
> procedure ColorLocatePrintTextOnly() 
> type_check failure, Text is 72'H' 
>     FGC = 14
>     BGC = 1
>     Row = 1
>     Col = 1
>     Text = 72'H'
> 
> ... called from D:\LEKSSOFT\EUPHORIA\SOURCE\LEARNING\LEARNING.EX:21 
> 
> 
> Global & Local Variables
> 
>  C:\Progra~1\Euphoria\include\get.e:
>     input_file = <no value>
>     input_string = <no value>
>     string_next = <no value>
>     ch = <no value>
> 
>  C:\Progra~1\Euphoria\include\graphics.e:
>     BLUE = 1
>     CYAN = 3
>     RED = 4
>     BROWN = 6
>     BRIGHT_BLUE = 9
>     BRIGHT_CYAN = 11
>     BRIGHT_RED = 12
>     YELLOW = 14
> 
>  C:\Progra~1\Euphoria\include\misc.e:
>     pretty_end_col = <no value>
>     pretty_chars = <no value>
>     pretty_start_col = <no value>
>     pretty_level = <no value>
>     pretty_file = <no value>
>     pretty_ascii = <no value>
>     pretty_indent = <no value>
>     pretty_ascii_min = <no value>
>     pretty_ascii_max = <no value>
>     pretty_line_count = <no value>
>     pretty_line_max = <no value>
>     pretty_dots = <no value>
>     pretty_fp_format = <no value>
>     pretty_int_format = <no value>
>     pretty_line = <no value>
> 
>  D:\LEKSSOFT\EUPHORIA\SOURCE\LEARNING\LEARNING.EX:
>     Text = {72'H'}
>     Key = 72'H'
> </eucode>
{{{

> 
> Tell me what I'm doing wrong?
> 
> Love & Friendship & Blessed Be!
> Lynn Erika Kilroy

It looks like you are passing an integer or an atom where Euphoria expects a
sequence. This is a common problem. Whichever way you are calling
ColorLocatePrintTextOnly(), wrap the Text parameter with {}. That is call it like
so:
ColorLocatePrintTextOnly(FGC, BGC, Row, Col, {Key})

Without more information of what kind of tidbits you are adding, that is all I
can come up with.

You could also change the ColorLocatePrintTextOnly definition to accept an
object for Text instead of a sequence:
procedure ColorLocatePrintTextOnly(integer FGC, integer BGC, integer Row,
integer Col, object Text)

> > 
> > Of course you could just use gets(), see 
> > <a
> > href="http://www.rapideuphoria.com/lib_e_g.htm#gets">http://www.rapideuphoria.com/lib_e_g.htm#gets</a>
> > example 2.
> > 
> > 
> > Try using the web interface directly to the Forum 
> > <a
> > href="http://www.listfilter.com/EUforum">http://www.listfilter.com/EUforum</a> it
> > works very well, much better than
> > Topica.
> > 
> 
> I hate random passwords.

Yeah, but if you use cookies (I know some people don't) then it is saved on your
computer. Really, it is a better way to access the list.

But, whatever works for you.

> 
> Love & Friendship & Blessed Be!
> Lynn Erika Kilroy
> 
> 
--
"The author regrets that he is unable to reconcile himself to the
thoughtful point of view you have expressed. However, it must be kept
in mind that being raised in different cultures and different places can
result in such differences of viewpoint between individuals.
The author is from planet Earth." [author unknown]

j.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu