How to define a function using foldr for rpn in haskell? [closed]

核能气质少年 提交于 2020-01-07 09:57:07

问题


i am in the process of learning haskell and i am currently trying to define a function using foldr for an rpn evaluator.

this is the function, it takes in a list of strings and returns it as an int any help is appreciated.

rpnRec :: [String] -> Int

for example:

 rpnRec ["2", "4", "+"] = 6

however i know how to do this using foldl. Thank you

来源:https://stackoverflow.com/questions/59590468/how-to-define-a-function-using-foldr-for-rpn-in-haskell

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!