1. Help,Help,Help and Hello again

Hi
First my name is David Mosley for anyone that does not know me I was on the
list awhile back and I am a beginner Programmer I have programmed in
basic(Liberty Basic,jiffy Basic,GW Basic) the jiffy basic was the basic on
the C-64.Well I have started to get Euphoria after about 2 year's of
studying,but still have problems with it I don't understand it I can make a
Basic program (I have written about 50 or so) but when it comes to Euphoria
to get lost on the RDS page it says that Euphoria is SIMPLE for
who??????????????.
Know I want to write about my feelings,I like Euphoria I think it is a good
programming lang,but the Libery.doc,refman.doc file is not it is hard to
understand and does not help to look at it ,it needs to be rewritten for
the beginner not for the advanced programer.I have studdyed ABGTE2 and it
has helped but is there other help out there I mean for the BEGINNER not
the ADVANCED programer.I am probley frustrated right now so please excuse
the forwardness of this post,but I can not help it did anyone write a book
on Euphoria I would buy it in a minte as long it was for the BEGINNER
programer,is there a Web site out there for the Beginner????????.Well I
have a ? about some thing here it goes when you print to a file I use
1(print) 2 (puts) I have tried both and find that print does ok but when I
try to read back the file I get this {56,57,45,32,} and when I use puts I
get {oct,and then some strange characters} attached is a program that I am
working on it is good for the beginners I use the puts allot and the print
too.Thanks for the help

David
pmosley at infoway.lib.nm.us

new topic     » topic index » view message » categorize

2. Re: Help,Help,Help and Hello again

On Fri, 22 Sep 2000, David Mosley wrote:
> Hi
> First my name is David Mosley for anyone that does not know me I was on the
> list awhile back and I am a beginner Programmer I have programmed in
> basic(Liberty Basic,jiffy Basic,GW Basic) the jiffy basic was the basic on
> the C-64.Well I have started to get Euphoria after about 2 year's of
> studying,but still have problems with it I don't understand it I can make a
> Basic program (I have written about 50 or so) but when it comes to Euphoria
> to get lost on the RDS page it says that Euphoria is SIMPLE for
> who??????????????.

No offense intended, but it seems that BASIC experience is a hindrance to
learning Euphoria. If you can put that experience aside for a while, you'll
find Euphoria easier.

>did anyone write a book
> on Euphoria I would buy it in a minte as long it was for the BEGINNER
> programer,is there a Web site out there for the Beginner????????.

I don't know of a book (yet)

> Well I have a ? about some thing here it goes when you print to a file I use
> 1(print) 2 (puts) I have tried both and find that print does ok but when I
> try to read back the file I get this {56,57,45,32,} and when I use puts I
> get {oct,and then some strange characters} attached is a program that I am
> working on it is good for the beginners I use the puts allot and the print
> too.Thanks for the help

You can use the combination of print() and get() to write and read data very
easily, if you structure that data correctly.

I would restructure the program in order to save myself a lot of typing and
debugging opportunities. When you reference many "loose" variables, there's
always a chance of missing some whenever you make a minor change to your
program, plus it's much more convenient to read or write an entire batch of
related data with one command, instead of with dozens of lines.

Your menu code was just fine, as was your use of Gabriel Boehms' PRINT.E.
Try using your menu to call the routines below:

Regards,
Irv

 -- Budget
include get.e
include print.e

constant MONTH = 1, INCOME = 2, EXP = 3,
                                NAME = 1,
                                AMOUNT = 2
object budget
     budget = {" ", -- month
                0,  -- income
               {{"T-Rent:   ",0}, -- expenses
                {"S-Rent:   ",0},
                {"Electric: ",0},
                {"Phome:    ",0},
                {"Gas:      ",0},
                {"Misc 1:   ",0},
                {"Misc 2:   ",0},
                {"Misc 3:   ",0},
                {"Pawn:     ",0}}}

procedure get_amounts()
clear_screen()
budget[MONTH] = prompt_string("Month: ")
budget[INCOME] = prompt_number("Income: ",{0,4000})
for i = 1 to length(budget[EXP]) do
  budget[EXP][i][AMOUNT] = prompt_number(budget[EXP][i][NAME],{})
end for
end procedure

procedure show_total()
atom total_exp
clear_screen()
total_exp = 0
printf(1,"Balance for month of %s\n",{budget[MONTH]})
printf(1,"Total income:   %8.2f\n",budget[INCOME])
printf(1,"Itemized expenses:\n",{})
for i = 1 to length(budget[EXP]) do
 printf(1,"%14s =%8.2f\n",{budget[EXP][i][NAME],budget[EXP][i][AMOUNT]})
 total_exp += budget[EXP][i][AMOUNT]
end for
printf(1,"Total expenses: %8.2f\n",total_exp)
printf(1,"                ________\n",{})
printf(1,"Balance:        %8.2f\n",budget[INCOME]-total_exp)
end procedure

function save_data()
atom fn
sequence fname
fname = prompt_string("Enter filename: ")
fn = open(fname,"w")
if fn < 1 then return fn
else
 print(fn,budget)
 close(fn)
 return 1
end if
end function

procedure new()
get_amounts()
show_total()
if save_data() then
   puts(1,"DATA SAVED")
else
   puts(1,"ERROR SAVING DATA FILE")
end if
end procedure

procedure load_data()
atom fn
sequence fname
fname = prompt_string("Filename to load: ")
fn = open(fname,"r")
if fn < 1 then
   puts(1,"CANNOT OPEN FILE")
   abort(1)
else
  budget = get(fn)
  budget = budget[2]
  close(fn)
end if
end procedure

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

3. Re: Help,Help,Help and Hello again

On Fri, 22 Sep 2000, David Mosley wrote:
> Hi
> First my name is David Mosley for anyone that does not know me I was on the
> list awhile back and I am a beginner Programmer I have programmed in
> basic(Liberty Basic,jiffy Basic,GW Basic) the jiffy basic was the basic on
> the C-64.Well I have started to get Euphoria after about 2 year's of
> studying,but still have problems with it I don't understand it I can make a
> Basic program (I have written about 50 or so) but when it comes to Euphoria
> to get lost on the RDS page it says that Euphoria is SIMPLE for
> who??????????????.
> Know I want to write about my feelings,I like Euphoria I think it is a good
> programming lang,but the Libery.doc,refman.doc file is not it is hard to
> understand and does not help to look at it ,it needs to be rewritten for
> the beginner not for the advanced programer.I have studdyed ABGTE2 and it
> has helped but is there other help out there I mean for the BEGINNER not
> the ADVANCED programer.I am probley frustrated right now so please excuse
> the forwardness of this post,but I can not help it did anyone write a book
> on Euphoria I would buy it in a minte as long it was for the BEGINNER
> programer,is there a Web site out there for the Beginner????????.Well I
> have a ? about some thing here it goes when you print to a file I use
> 1(print) 2 (puts) I have tried both and find that print does ok but when I
> try to read back the file I get this {56,57,45,32,} and when I use puts I
> get {oct,and then some strange characters} attached is a program that I am
> working on it is good for the beginners I use the puts allot and the print
> too.Thanks for the help
>
> David
> pmosley at infoway.lib.nm.us

perhaps there are a few things you should learn first that are programming
related but not specific to one language or another. do you know what ASCII is?
do you understand iteration as in looping? ( while, for, etc ) what about
conditional statements? ( if, else, then )

if you do not know those things i mentioned are, then you should learn them by
reading very beginner stuff from a book or article aimed at begginer
programmers ( NOT SPECIFIC LANGUAGE BASED ) that dont have this kind of
knowledge yet.

i would suggest a book or two for you but its been a while since ive been down
to the local book store and its also been a while since i was reading those
books myself.

--
evil, corruption and bad taste
  ^cense

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

4. Re: Help,Help,Help and Hello again

ya know the stuff does look kinda like RPN-Lisp (sorta)
Mike
Swayze
Mswayze at Truswood.com
Kswayze at Bellsouth.net
----- Original Message -----
From: "David Mosley" <pmosley at INFOWAY.LIB.NM.US>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Friday, September 22, 2000 4:09 PM
Subject: Help,Help,Help and Hello again


> Hi
> First my name is David Mosley for anyone that does not know me I was on
the
> list awhile back and I am a beginner Programmer I have programmed in
> basic(Liberty Basic,jiffy Basic,GW Basic) the jiffy basic was the basic on
> the C-64.Well I have started to get Euphoria after about 2 year's of
> studying,but still have problems with it I don't understand it I can make
a
> Basic program (I have written about 50 or so) but when it comes to
Euphoria
> to get lost on the RDS page it says that Euphoria is SIMPLE for
> who??????????????.
> Know I want to write about my feelings,I like Euphoria I think it is a
good
> programming lang,but the Libery.doc,refman.doc file is not it is hard to
> understand and does not help to look at it ,it needs to be rewritten for
> the beginner not for the advanced programer.I have studdyed ABGTE2 and it
> has helped but is there other help out there I mean for the BEGINNER not
> the ADVANCED programer.I am probley frustrated right now so please excuse
> the forwardness of this post,but I can not help it did anyone write a book
> on Euphoria I would buy it in a minte as long it was for the BEGINNER
> programer,is there a Web site out there for the Beginner????????.Well I
> have a ? about some thing here it goes when you print to a file I use
> 1(print) 2 (puts) I have tried both and find that print does ok but when I
> try to read back the file I get this {56,57,45,32,} and when I use puts I
> get {oct,and then some strange characters} attached is a program that I am
> working on it is good for the beginners I use the puts allot and the print
> too.Thanks for the help
>
> David
> pmosley at infoway.lib.nm.us

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

5. Re: Help,Help,Help and Hello again

> No offense intended, but it seems that BASIC experience is a hindrance to
> learning Euphoria. If you can put that experience aside for a while,
you'll
> find Euphoria easier.
Hi
Yes I totally agree with that,I stopped programming in basic a month
ago,but the bad habits are still there.I will keep trying to understand
this stuff,when I was in basic I had to find so many work arounds that it
was not funny to get things done (Don't get me started on Random files) I
personal feel that the guy who cameup with random files should be
SHOT({LOL}{LOL}{LOL})
I can see the power that Euphoria has and love it if I could just get it
into my head.


> You can use the combination of print() and get() to write and read data
very
> easily, if you structure that data correctly.
>
> I would restructure the program in order to save myself a lot of typing
and
> debugging opportunities. When you reference many "loose" variables,
there's
> always a chance of missing some whenever you make a minor change to your
> program, plus it's much more convenient to read or write an entire batch
of
> related data with one command, instead of with dozens of lines.
>
> Your menu code was just fine, as was your use of Gabriel Boehms' PRINT.E.
> Try using your menu to call the routines below:
>
> Regards,
> Irv
Thanks for the help I will study it,The print.e is a good include file I
don't know if it is for the Linux Version? as far as the print statement
sometimes it works for me and somtimes it does not I think I have not
learned how to use it yet. let me ask a ? about it .if you print to a file
and then read it back and then print(puts) it back to the sreen will it be
readably? or do you have to do something to it.


> object budget
>      budget = {" ", -- month
>                 0,  -- income
>                {{"T-Rent:   ",0}, -- expenses
>                 {"S-Rent:   ",0},
>                 {"Electric: ",0},
>                 {"Phome:    ",0},
>                 {"Gas:      ",0},
>                 {"Misc 1:   ",0},
>                 {"Misc 2:   ",0},
>                 {"Misc 3:   ",0},
>                 {"Pawn:     ",0}}}
>
> procedure get_amounts()
> clear_screen()
> budget[MONTH] = prompt_string("Month: ")
> budget[INCOME] = prompt_number("Income: ",{0,4000})
 What is the 4000 there? I didn't know you could do that to the
prompt_number or string you learn something new everyday.

Thanks for all the help I am sorry for the 1 post I broke my rule DO not
post untill 2 hours after I have some truble so that I can cool down.Thanks
again.

David
pmosley at infoway.lib.nm.us

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

6. Re: Help,Help,Help and Hello again

On Fri, 22 Sep 2000, David Mosley wrote:

> Thanks for the help I will study it,The print.e is a good include file I
> don't know if it is for the Linux Version?

Yes, it works in all versions. It's useful for print()ing things to disk files
while maintaining them in human readable (and editable) form. Unlike Euphoria's
built-in print() command, which prints things as numbers:
e.g. a sequence like this: s = {"Hello",1,2,3}
will be printed as {{72,101,108,108,111},1,2,3} by Euphoria's print() function,
and as {"Hello",1,2,3} by PRINT.E.'s print() function.
The second version saves disk space and is certainly more readable.
Either version can be read back in using the standard get() function.

 > as far as the print statement > sometimes it works for me and somtimes it
does not I think I have not > learned how to use it yet. let me ask a ? about
it .if you print to a file > and then read it back and then print(puts) it back
to the sreen will it be > readably? or do you have to do something to it.

You certainly do need to do something first - when reading data back in
with get(), you get not only the original data, but also an error code, like so:
{0,{{72,101,108,108,111},1,2,3}}
That zero at the beginning is the flag meaning "success" in reading the file,
so you check it, and then remove it from your actual data:
object data
data = get(fn)
if data[1] = GET_SUCCESS then
  data = data[2] -- read was good
else
 puts(1,"ERROR IN DATA")
....
> > budget[INCOME] = prompt_number("Income: ",{0,4000})
>  What is the 4000 there? I didn't know you could do that to the
> prompt_number or string you learn something new everyday.

That sets the minimum and maximum acceptable inpuit ~
if you were to try to enter -1, for example, Euphoria will print a message:
"A number between 0 and 4000 is required" and give you a chance to redo the
entry.

Regards,
Irv

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

Search



Quick Links

User menu

Not signed in.

Misc Menu