views:

159

answers:

2
I want to define function called Balanced that takes string containing parentheses and returns true if the parentheses in this string are Balanced and False if not In Haskell Please
+1  A: 

What kind of data structures did you learn that you think can help you out on this?

Oren A
just I in haskell language
jurey
@jurey, I'm willing to help you get to the answer, but I'm not going to give it to you, nor should you look for that..
Oren A
I just want to understand how to do it
jurey
Well what are your thoughts? And on what subject is this exercise (as there are a lot of ways to solve it)?
Oren A
Oren A I don't have time and I tried but it gave me wrong
jurey
SO Will help Me or not? and I'm still think but I have to do another thing really important
jurey
What is the subject of the question? Loops? Data structures? Something else?
Oren A
write program in Haskell language
jurey
Please tell me because a week was thinking
jurey
I will really grateful
jurey
Don't speak Haskell too. Sorry
Oren A
+5  A: 

Start from left and count +1 for every opening and -1 for every closing parenthesis. Return true if the counter is 0 at the end and it's minimum was 0 or higher (the counter never get's negative values). For example:

( ( ( ) ( ) ) ( )
0 1 2 1 2 1 0 1 0
SinistraD
@SinistraD: This is usually a data structure exercise (although we can't really tell yet).
Oren A
Can you help me by sowing me how to write this code only because I couldn't
jurey
Sorry I can't, for 2 reasons: 1.) we are not solving homework here, it's homework, because you should learn something about it 2.) I don't speak the Haskell language. Nor any other functional language. These 2 reason's why I gave you a general answer
SinistraD