[Haskell-beginners] Re: Help in Haskell

Benjamin L.Russell DekuDekuplex at Yahoo.com
Tue Nov 25 03:11:29 EST 2008


This looks like a homework question.  While we are all here to help
you figure out a solution, it would be unethical just to give you a
solution to a homework problem; rather, we are here to help you figure
out the solution yourself.

As such, first, please follow the homework help procedure outlined in
"Homework help - HaskellWiki" (see
http://www.haskell.org/haskellwiki/Homework_help) (substitute
"haskell-beginners or haskell-cafe" for "haskell-cafe," and just
ignore the part about the existence of "stupid questions"--there is no
such thing as a "stupid question"; however, there are such things as
appropriate questions and inappropriate questions, and in order for us
to help you appropriately in this context, you need to show us more
specifically what you have done and where you are stuck, so that we
can provide help that would be appropriate in this context).

Specifically, please follow the following procedure first:

>   1.  Read the problem carefully and make sure you understand what is being asked of you.
>   2. If you can't solve the whole problem, try breaking the problem down into parts and solving those parts.
>   3. If you can't write it in Haskell, try writing it in English (or your native language) first.
>   4. If you can't write code, try at least writing a type signature.
>   5. Look through the libraries provided by Haskell, particularly those parts which have been pointed out to you in class or in your course notes. There may be something there which helps you. 

If you are still stuck, then it might be useful to follow the
following steps from the procedure listed on the above-mentioned
homework help page:

>   4. Try to make your question as specific as possible. Say what problem (or subproblem) you are stuck on as succinctly as you can. If the original homework question is long, don't copy it verbatim (though if it's available on the web, a link couldn't hurt).
>   5. Say what you've done so far, and include code. People are much more likely to help you fix your incorrect code than write correct code for you. Moreover, if the problem is that you don't understand something, your incorrect code will probably reflect this, and fixing your misunderstanding is much more valuable than fixing your code. 

In the above-mentioned procedure, the more detail you provide, the
more helpful we can be in our hints.

-- Benjamin L. Russell

On Mon, 24 Nov 2008 05:04:12 -0200, "Andre Paulo Machado"
<andre.panm at gmail.com> wrote:

>Hi folks..... Somebody could help me, please?
>
>Please, I would like a help in haskell programming, because I have with
>following question:
>
>I need to create a list of strings, like as a graph.
>See:
>
>initiaList = [ ("BSB,"SSA"),
>                   ("CNF","SSA"),
>                   ("CNF","GIG"),
>                   ("CNF","GRU"),
>                   ("GIG","CNF"),
>                   ("GIG","GRU"),
>                   ("GRU","BSB"),
>                   ("GRU","GIG"),
>                   ("GRU","CNF"),
>                   ("SSA","CNF") ]
>
>With this list above, I will create a function that returns a path with max
>number of links:
>example:
>
>maxLink = 4 (result until 4)
>
>command:   myFunction "BSB"  "GRU" 4
>result:          1st Option:   BSB -> SSA -> CNF -> GRU
>                    2nd Option:  BSB -> SSA -> CNF -> GIG -> GRU
>----------------------------------------------------------------------------
>command:   myFunction "BSB"  "GRU" 3
>result:          1st Option:   BSB -> SSA -> CNF -> GRU
>----------------------------------------------------------------------------
>
>How do this?
>I'm waiting from you,
>thank you so much.
>
>Andre



More information about the Beginners mailing list