[Haskell-cafe] Homework help - calculator function
I have a homework which is very important to be done but I can't complete the task at all. The program i should write is: Make calculator- function in Haskell. The function argument is a list of strings and also form such list, as each string of the argument made definite action. • If the string has the form of an arithmetic expression - calculate this expression. The string result becomes part of the list-result. If the expression contains a variable which is not assigned value, the result is displayed undefined. • If the string has the form Name = value calculated from the last expression is assigned to the variable with the corresponding name in the list, and in the result list is formed a string with type name = ... where the site stands blank corresponding value. If there is not a calculated expression to be assigned to form a string no value. • If the string is non-blank, but there is a species different from the above two case, form the string error. • If the string is empty, incl. when it contains only spaces, in the result there is not form a string. Expressions consist of integers without sign variables, operations + (Addition), - (subtraction), * (multiplication) and / (divide) and parentheses. Where no brackets, the operations are performed from left to right, but * and / precede the + and -. Implementation of any operation gives integer; in the division rejected the fractional part , if any . Variables have names of one letter - from the Latin small letter . In the beginning, end or between the elements of each row can have spaces - they are irrelevant to its correctness. Example: the list-argument [3 +7 / 2 2 + x, = s, 2 * s +4, , 2 + +4 / 5] function should provide a result-list [6, undefined, s = 6, 16, error].Thank you an advance! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Homework help - calculator function
On Wed, Jun 22, 2011 at 4:39 PM, SM Design social_me...@abv.bg wrote: I have a homework which is very important to be done but I can't complete the task at all. The program i should write is: Nobody on this list is going to do your homework for you, or at least I hope not. Before you expect to get help, you should a) demonstrate that you've made an effort to solve the problem on your own, b) explain where you've gotten stuck and what it is you don't understand about how to move forward. G -- Gregory Collins g...@gregorycollins.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Homework help - calculator function
On Wed, Jun 22, 2011 at 10:39 PM, SM Design social_me...@abv.bg wrote: I have a homework which is very important to be done but I can't complete the task at all. The program i should write is: http://www.haskell.org/haskellwiki/Homework_help ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Homework help - calculator function
2011/6/22 Gregory Collins g...@gregorycollins.net: On Wed, Jun 22, 2011 at 4:39 PM, SM Design social_me...@abv.bg wrote: I have a homework which is very important to be done but I can't complete the task at all. The program i should write is: Nobody on this list is going to do your homework for you, or at least I hope not. Before you expect to get help, you should a) demonstrate that you've made an effort to solve the problem on your own, b) explain where you've gotten stuck and what it is you don't understand about how to move forward. In addition to what Gregory said, please have a look to this page: http://www.haskell.org/haskellwiki/Homework_help Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe