Writing a bag (multiset) generic package in Ada
up vote
-3
down vote
favorite
I am new to Ada and learning it i came across a problem as writing a bag (multiset) generic package this contains elements and multiplicity as well.
The bag type has to be a record with discriminant which is maximum capacity of the bag In the record put an array that contains (element, multiplicity) pairs.
The type of the elements is the parameter of the generic package.
Define the Add
and the Remove
procedures, and the Multiplicity
function
over the type Bag
.
Write a For_Each
iterator, which is an inner generic procedure.
This generic has a Process_Elem
parameter procedure which will be applied over each pair of a bag.
In a demo program illustrate the usage of the operations of the package instantiated for integers.
algorithm ada array-algorithms
add a comment |
up vote
-3
down vote
favorite
I am new to Ada and learning it i came across a problem as writing a bag (multiset) generic package this contains elements and multiplicity as well.
The bag type has to be a record with discriminant which is maximum capacity of the bag In the record put an array that contains (element, multiplicity) pairs.
The type of the elements is the parameter of the generic package.
Define the Add
and the Remove
procedures, and the Multiplicity
function
over the type Bag
.
Write a For_Each
iterator, which is an inner generic procedure.
This generic has a Process_Elem
parameter procedure which will be applied over each pair of a bag.
In a demo program illustrate the usage of the operations of the package instantiated for integers.
algorithm ada array-algorithms
4
What is your question? Hopefully you aren't asking us to provide a complete solution to the exercise?
– Jacob Sparre Andersen
Nov 11 at 11:04
add a comment |
up vote
-3
down vote
favorite
up vote
-3
down vote
favorite
I am new to Ada and learning it i came across a problem as writing a bag (multiset) generic package this contains elements and multiplicity as well.
The bag type has to be a record with discriminant which is maximum capacity of the bag In the record put an array that contains (element, multiplicity) pairs.
The type of the elements is the parameter of the generic package.
Define the Add
and the Remove
procedures, and the Multiplicity
function
over the type Bag
.
Write a For_Each
iterator, which is an inner generic procedure.
This generic has a Process_Elem
parameter procedure which will be applied over each pair of a bag.
In a demo program illustrate the usage of the operations of the package instantiated for integers.
algorithm ada array-algorithms
I am new to Ada and learning it i came across a problem as writing a bag (multiset) generic package this contains elements and multiplicity as well.
The bag type has to be a record with discriminant which is maximum capacity of the bag In the record put an array that contains (element, multiplicity) pairs.
The type of the elements is the parameter of the generic package.
Define the Add
and the Remove
procedures, and the Multiplicity
function
over the type Bag
.
Write a For_Each
iterator, which is an inner generic procedure.
This generic has a Process_Elem
parameter procedure which will be applied over each pair of a bag.
In a demo program illustrate the usage of the operations of the package instantiated for integers.
algorithm ada array-algorithms
algorithm ada array-algorithms
edited Nov 11 at 11:13
LukStorms
11k31532
11k31532
asked Nov 11 at 9:32
csc tikonapark
12
12
4
What is your question? Hopefully you aren't asking us to provide a complete solution to the exercise?
– Jacob Sparre Andersen
Nov 11 at 11:04
add a comment |
4
What is your question? Hopefully you aren't asking us to provide a complete solution to the exercise?
– Jacob Sparre Andersen
Nov 11 at 11:04
4
4
What is your question? Hopefully you aren't asking us to provide a complete solution to the exercise?
– Jacob Sparre Andersen
Nov 11 at 11:04
What is your question? Hopefully you aren't asking us to provide a complete solution to the exercise?
– Jacob Sparre Andersen
Nov 11 at 11:04
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53247422%2fwriting-a-bag-multiset-generic-package-in-ada%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
4
What is your question? Hopefully you aren't asking us to provide a complete solution to the exercise?
– Jacob Sparre Andersen
Nov 11 at 11:04