views:
159answers:
2I 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
2010-09-12 20:41:24
just I in haskell language
jurey
2010-09-12 20:43:28
@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
2010-09-12 20:45:33
I just want to understand how to do it
jurey
2010-09-12 20:49:45
Well what are your thoughts? And on what subject is this exercise (as there are a lot of ways to solve it)?
Oren A
2010-09-12 20:50:30
Oren A I don't have time and I tried but it gave me wrong
jurey
2010-09-12 21:44:39
SO Will help Me or not? and I'm still think but I have to do another thing really important
jurey
2010-09-12 21:45:58
What is the subject of the question? Loops? Data structures? Something else?
Oren A
2010-09-12 21:47:44
write program in Haskell language
jurey
2010-09-12 21:50:16
Please tell me because a week was thinking
jurey
2010-09-12 21:53:24
I will really grateful
jurey
2010-09-12 22:00:19
Don't speak Haskell too. Sorry
Oren A
2010-09-12 22:18:08
+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
2010-09-12 20:42:45
@SinistraD: This is usually a data structure exercise (although we can't really tell yet).
Oren A
2010-09-12 20:53:00
Can you help me by sowing me how to write this code only because I couldn't
jurey
2010-09-12 21:48:06
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
2010-09-12 22:12:49