comp.lang.ada
 help / color / mirror / Atom feed
* Need help bad!!!!!
@ 1996-10-27  0:00 BlacKnight
  1996-10-27  0:00 ` David C. Hoos, Sr.
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: BlacKnight @ 1996-10-27  0:00 UTC (permalink / raw)



This is going to sound really stupid, and I'm extremely frustrated because I 
know there has to be a simple answer to this:

	I have a linked list lab I've been working on for college. I've gotten 
the sort, etc working, except for 3 procedures that depend on this problem I'm 
having. I need to have the user input a name (name : string(1..20);) to do one 
of 3 options, add a record, display a records info, or delete the record. I've 
been reading the input a character at a time and using an if condition to check 
for Ascii.LF so the program can take whats entered and store it in name, and 
then continue with the option selected. I can't get the program to accept any 
type of carriage return, it always wants 20 characters no matter what. So the 
user has to hit the space bar after entering the name until 20 cells in the 
string are filled. I've tried unbounded_strings, ascii values, comparisons, 
conditions, get_line(), get(), even dropped the code for get_line out of 
gnat.io. None of this works. If anyone has some help, please post or email me 
at : amolthan@cdsnet.net

Thanks alot,
Alex





^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Need help bad!!!!!
  1996-10-27  0:00 Need help bad!!!!! BlacKnight
@ 1996-10-27  0:00 ` David C. Hoos, Sr.
  1996-10-27  0:00   ` Robert Dewar
  1996-10-27  0:00 ` Need help bad!!!!! Larry Kilgallen
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: David C. Hoos, Sr. @ 1996-10-27  0:00 UTC (permalink / raw)



You need to be using Text_IO.Get_Line which has parameters both for the
string into which you write, and a parameter "Last : out Natural", which is
set to the last character in the string which was set by the operation.
Get_Line terminates on either the exhaustion of the space in the provided
string, or the end of the input line (whether from a disk file or the
keyboard (note that there are overloaded versions of Get_Line).  Then, if
you test for Last = My_string'Last, you will know that there may be more
characters on the line than My_String provides.  If the equality test
fails, then the slice of the string you want is My_String (1 .. Last).

The Ada Language Reference Manual makes this all abundantly clear.  The
Reference manuals for both Ada95 and Ada83 (along with an abundance of
other reference material are available in hypertext format at
"http://adahome.com/Resources/References.html"

It would really be nice if we could get people to read the LRM before
posting questions, but, alas, I find in my work in industry that even
people who have been programming for years are too lazy to look it up if
there's someone nearby handy to ask.
-- 
David C. Hoos, Sr.,
http://www.dbhwww.com
http://www.ada95.com

BlacKnight <amolthan@cdsnet.net> wrote in article
<54u8m2$ko1@news.cdsnet.net>...
> This is going to sound really stupid, and I'm extremely frustrated
because I 
> know there has to be a simple answer to this:
> 
> 	I have a linked list lab I've been working on for college. I've gotten 
> the sort, etc working, except for 3 procedures that depend on this
problem I'm 
> having. I need to have the user input a name (name : string(1..20);) to
do one 
> of 3 options, add a record, display a records info, or delete the record.
I've 
> been reading the input a character at a time and using an if condition to
check 
> for Ascii.LF so the program can take whats entered and store it in name,
and 
> then continue with the option selected. I can't get the program to accept
any 
> type of carriage return, it always wants 20 characters no matter what. So
the 
> user has to hit the space bar after entering the name until 20 cells in
the 
> string are filled. I've tried unbounded_strings, ascii values,
comparisons, 
> conditions, get_line(), get(), even dropped the code for get_line out of 
> gnat.io. None of this works. If anyone has some help, please post or
email me 
> at : amolthan@cdsnet.net
> 
> Thanks alot,
> Alex
> 
> 




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Need help bad!!!!!
  1996-10-27  0:00 Need help bad!!!!! BlacKnight
  1996-10-27  0:00 ` David C. Hoos, Sr.
@ 1996-10-27  0:00 ` Larry Kilgallen
  1996-10-27  0:00 ` Robert Dewar
  1996-10-28  0:00 ` BlacKnight
  3 siblings, 0 replies; 10+ messages in thread
From: Larry Kilgallen @ 1996-10-27  0:00 UTC (permalink / raw)



In article <54u8m2$ko1@news.cdsnet.net>, amolthan@cdsnet.net (BlacKnight) writes:

> 	I have a linked list lab I've been working on for college.

Some of the professors who read this list can correct me, but it seems
to me that your school should establish some sort of lab assistance
program for getting help rather than blasting messages across the whole
Internet.

> gnat.io. None of this works. If anyone has some help, please post or
> email me at : amolthan@cdsnet.net

When you find that local resource, you probably want to show them your
program, rather than just describing your symptoms.

Looking at your description, however, the one think which strikes me
is how many instances  you have of the number "20", both for your goal
and for your "symptoms".  Independent of whether you are using Ada or
Pascal or Cobol, I bet that if you changed the program from "20" to "17"
you would see that your symptoms also changed from "20" to "17".  That
experiment may be worth investigating.  The Ada language goes a long
way toward detecting most errors with the compiler, but still there
will always be problems such as yours where experimenting with the
program and rereading the Ada Reference Manual are required.  After all,
the behaviour you describe sounds pretty good if your goal were to read
20-column punched cards, and I bet I know how to make it work with the
more traditional 80 column cards :-)

Larry Kilgallen




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Need help bad!!!!!
  1996-10-27  0:00 ` David C. Hoos, Sr.
@ 1996-10-27  0:00   ` Robert Dewar
  1996-10-27  0:00     ` Textbooks vs. Reference Manuals (was: Need help bad!!!!! (sic)) Larry Kilgallen
  0 siblings, 1 reply; 10+ messages in thread
From: Robert Dewar @ 1996-10-27  0:00 UTC (permalink / raw)



David Hoos says

"It would really be nice if we could get people to read the LRM before
posting questions, but, alas, I find in my work in industry that even
people who have been programming for years are too lazy to look it up if
there's someone nearby handy to ask."

Two responses, first, why should they bother, if you are willing to answer
their questions in such detail for them. This teaches laziness. Please be
careful about helping students TOO much, see my previous post on this
subject. You are NOT doing them a favor by spoon-feeding them. They need
precisely to learn how to read and solve their own problems.

Second, the RM is not at all the right source to point people to. Instead
they need to be reading a good text book. Much of the RM is inpenetrable
even to most of the experts, unless you already understand 95% of what
you need already. It *is* good for filling in the remaining subtle 5%

Also, to be fair, Annex A is more accessiible than much of the rest, but
still sending a student with this level of misunderstanding to the RM is
not helpful!

Students tend often to the path of least resistance in doing assignments.
They write down some approximate junk without making any effort to find
out how to do things (trying to use Text_IO as though it is identical
semantically to C getchar is an example), and then get people to help them
fix it.

Let's be helpful to students, but not TOO helpful :-)





^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Need help bad!!!!!
  1996-10-27  0:00 Need help bad!!!!! BlacKnight
  1996-10-27  0:00 ` David C. Hoos, Sr.
  1996-10-27  0:00 ` Need help bad!!!!! Larry Kilgallen
@ 1996-10-27  0:00 ` Robert Dewar
  1996-10-28  0:00 ` BlacKnight
  3 siblings, 0 replies; 10+ messages in thread
From: Robert Dewar @ 1996-10-27  0:00 UTC (permalink / raw)



iAlex said

"        I have a linked list lab I've been working on for college. I've gotten
the sort, etc working, except for 3 procedures that depend on this problem I'm
having. I need to have the user input a name (name : string(1..20);) to do one
of 3 options, add a record, display a records info, or delete the record. I've
been reading the input a character at a time and using an if condition to check
for Ascii.LF so the program can take whats entered and store it in name, and"

This procedure is totally bogus in Ada, assuming you are using Text_IO. You
can't write C code in Ada this diretly, unless you call the real C routines
using pragma Interface, which probably would work. You need to study (from
almost any text book) how Text_IO is defined and works. You probably wanyt
to look at how Get_Line works.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* Textbooks vs. Reference Manuals  (was: Need help bad!!!!! (sic))
  1996-10-27  0:00   ` Robert Dewar
@ 1996-10-27  0:00     ` Larry Kilgallen
  1996-10-28  0:00       ` Stephen Leake
  1996-10-28  0:00       ` Robert Dewar
  0 siblings, 2 replies; 10+ messages in thread
From: Larry Kilgallen @ 1996-10-27  0:00 UTC (permalink / raw)




n article <dewar.846423455@merv>, dewar@merv.cs.nyu.edu (Robert Dewar) writes:

> Second, the RM is not at all the right source to point people to. Instead
> they need to be reading a good text book. Much of the RM is inpenetrable
> even to most of the experts, unless you already understand 95% of what
> you need already. It *is* good for filling in the remaining subtle 5%

Harrumph :-)

When I learned Ada, it was from the DEC documentation, which is
mainly their rendition of the Ada 83 reference manual.  Two other
volumes in the DEC Ada documentation give some VMS details, but
the only other book I found helpful was the style guide.

Lately I have been looking at textbooks, primarily for Ada 95
material.  Other than that new material, I have not read anything
which surprises me.

So did I learn Ada in a horribly inefficient manner, or does Ada 95
look straightforward due to having done object-oriented programming
before, or is Ada easier proportional to how many languages one has
used before, or is it easier if none of them was C ?

We all tend to recommend what works for ourselves.  My one training
axiom in industry is that some prefer a class, some prefer a mentor
and some prefer a set of books, but that division does not seem
relevant to the book choice guidance which has Robert provided.

Larry Kilgallen




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Need help bad!!!!!
  1996-10-27  0:00 Need help bad!!!!! BlacKnight
                   ` (2 preceding siblings ...)
  1996-10-27  0:00 ` Robert Dewar
@ 1996-10-28  0:00 ` BlacKnight
  1996-11-04  0:00   ` Robert Dewar
  3 siblings, 1 reply; 10+ messages in thread
From: BlacKnight @ 1996-10-28  0:00 UTC (permalink / raw)



In response to the help that I recieved here, thank you it is much 
appreciated for the diversment in ways to look at the problem I had. 
To these comments about helping students and reading the LRM and reference 
manual:
	Due to my teacher's lack of availability and the few people that I can 
find on campus that know ada, my resources here are not very exstenive. I use 
them when I can but they are rarely available. I did look through the LRM, the 
reference manual, the Rationale and numerous tutorials. I don't have the money 
to buy a manual on Ada. In the end the solution was simple, I should have seen 
it earlier. I did spend 8 - 9 hours working around the problem, the longer I 
worked on it, the farther away from the solution I got until I was utterly lost 
and frustrated. That is why I posted a request for help in this newsgroup. My 
apologies to those who found my request unfounded and irritable.
In article <54u8m2$ko1@news.cdsnet.net>, amolthan@cdsnet.net says...
>
>This is going to sound really stupid, and I'm extremely frustrated because I 
>know there has to be a simple answer to this:
>
>        I have a linked list lab I've been working on for college. I've gotten 
>the sort, etc working, except for 3 procedures that depend on this problem I'm 
>having. I need to have the user input a name (name : string(1..20);) to do one 
>of 3 options, add a record, display a records info, or delete the record. I've 
>been reading the input a character at a time and using an if condition to 
check 
>for Ascii.LF so the program can take whats entered and store it in name, and 
>then continue with the option selected. I can't get the program to accept any 
>type of carriage return, it always wants 20 characters no matter what. So the 
>user has to hit the space bar after entering the name until 20 cells in the 
>string are filled. I've tried unbounded_strings, ascii values, comparisons, 
>conditions, get_line(), get(), even dropped the code for get_line out of 
>gnat.io. None of this works. If anyone has some help, please post or email me 
>at : amolthan@cdsnet.net
>
>Thanks alot,
>Alex
>





^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Textbooks vs. Reference Manuals  (was: Need help bad!!!!! (sic))
  1996-10-27  0:00     ` Textbooks vs. Reference Manuals (was: Need help bad!!!!! (sic)) Larry Kilgallen
@ 1996-10-28  0:00       ` Stephen Leake
  1996-10-28  0:00       ` Robert Dewar
  1 sibling, 0 replies; 10+ messages in thread
From: Stephen Leake @ 1996-10-28  0:00 UTC (permalink / raw)



Larry Kilgallen wrote:
> 
> n article <dewar.846423455@merv>, dewar@merv.cs.nyu.edu (Robert Dewar) writes:
> 
> > Second, the RM is not at all the right source to point people to. Instead
> > they need to be reading a good text book. Much of the RM is inpenetrable
> > even to most of the experts, unless you already understand 95% of what
> > you need already. It *is* good for filling in the remaining subtle 5%
> 
> Harrumph :-)
> 
> When I learned Ada, it was from the DEC documentation, which is
> mainly their rendition of the Ada 83 reference manual.  Two other
> volumes in the DEC Ada documentation give some VMS details, but
> the only other book I found helpful was the style guide.
>
> [snip...]
>

I, too, first learned Ada 83 by reading the LRM. However, I agree with
Robert this time. The Ada 95 RM is NOT as good a place to start learning
Ada as the Ada 83 RM. The Ada 83 RM tended to discuss all of a topic in
one place, with some references to other parts of the manual. In the Ada
95 RM, I'm always flipping pages to find the whole story. Even then, I
often don't see it until I read the Rationale. I suspect this is partly
a consequence of the more "decoupled" nature of Ada 95 (with child
packages and tagged types, the CODE is certainly more spread around!).
It is also partly a consequence of being even more rigorous and
"legalistic" in style in the Ada 95 RM as opposed to the Ada 83 RM; this
is a GOOD THING for the language, but not for novices.

On the other hand, the Ada 95 Rationale IS a good place to learn the
extensions that Ada 95 makes to Ada 83, at least if you are generally
familiar with Ada 83. 

I don't have experience with entry level tutorials; I assume Lovelace
would be a good place to start.

> Larry Kilgallen

-- 
- Stephe




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Textbooks vs. Reference Manuals (was: Need help bad!!!!! (sic))
  1996-10-27  0:00     ` Textbooks vs. Reference Manuals (was: Need help bad!!!!! (sic)) Larry Kilgallen
  1996-10-28  0:00       ` Stephen Leake
@ 1996-10-28  0:00       ` Robert Dewar
  1 sibling, 0 replies; 10+ messages in thread
From: Robert Dewar @ 1996-10-28  0:00 UTC (permalink / raw)



iLarry says

"So did I learn Ada in a horribly inefficient manner, or does Ada 95
look straightforward due to having done object-oriented programming
before, or is Ada easier proportional to how many languages one has
used before, or is it easier if none of them was C ?"

There is a HUGE qualitative difference between the 83 RM and 95 RM in ease
of access for virtually everyone I ever met who has looked at both
documents in detail. Your experience with Ada 83 says nothing useful in
this discussion.

If you think that the Ada 95 RM is easy to read then either (a) you are
more brilliant than most of the rest of us or (b) you are fooling yourself!

The Ada 95 RM was deliberately written in considerably more precise and 
formal language than the Ada 83, this has its advantages and disadvantages,
but certainly accessibility is diminished. Try for example understanding
the rules for accessibility from the RM (even Bob Duff, who wrote them,
admits to some difficulty in interpreting them :-)

Similarly, if you really think you can easily understand the freezing
rules in ch 13 with no help, you are, as I say above, exceptional!





^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Need help bad!!!!!
  1996-10-28  0:00 ` BlacKnight
@ 1996-11-04  0:00   ` Robert Dewar
  0 siblings, 0 replies; 10+ messages in thread
From: Robert Dewar @ 1996-11-04  0:00 UTC (permalink / raw)



iBlackNight says

"        Due to my teacher's lack of availability and the few people that I can
find on campus that know ada, my resources here are not very exstenive. I use
them when I can but they are rarely available. I did look through the LRM, the
reference manual, the Rationale and numerous tutorials. I don't have the money
to buy a manual on Ada. In the end the solution was simple, I should have seen
it earlier. I did spend 8 - 9 hours working around the problem, the longer I
worked on it, the farther away from the solution I got until I was utterly lost
and frustrated. That is why I posted a request for help in this newsgroup. My
apologies to those who found my request unfounded and irritable.


So let's examine this. Because this student does not feel like buying a
text book, computing resources, and people's time around the world get used
up which in aggregate total FAR more than the cost of that text book, but
because the student does not pay, he does not care about this.

It is such incidents that increasingly make clear that the current model
of internet pricing is not viable in the long run. I notice for instance
that I get about 20 ads a day at my email address, well sure, why not,
it's absolutely free for people to send out mass bulk mailings in this
way. I see no reason why that number will not increase from 20 to 2000
a day, rendering my email address useless, unless a stop is put to this
kind of misuse of the net.

Going back to the issue of students. I would estimate that perhaps five to
ten thousand students are currently learning Ada world wide, perhaps I
am way under by a factor of ten, but even if ten thousand is right, and
they all post once a week to CLA. We then have well over a thousand messages
a day asking simple questions, and, as has happened to many other internet
newsgroups, CLA is destroyed, since no one reads it any more. And remember
my estimate might be off by a factor of ten!





^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~1996-11-04  0:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-10-27  0:00 Need help bad!!!!! BlacKnight
1996-10-27  0:00 ` David C. Hoos, Sr.
1996-10-27  0:00   ` Robert Dewar
1996-10-27  0:00     ` Textbooks vs. Reference Manuals (was: Need help bad!!!!! (sic)) Larry Kilgallen
1996-10-28  0:00       ` Stephen Leake
1996-10-28  0:00       ` Robert Dewar
1996-10-27  0:00 ` Need help bad!!!!! Larry Kilgallen
1996-10-27  0:00 ` Robert Dewar
1996-10-28  0:00 ` BlacKnight
1996-11-04  0:00   ` Robert Dewar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox