| |||
| 有个关于Scheme的问题要请教,要求用Scheme分别做个prefix calculator和一个 postfix calculator。 需要用到如下: (prefix-eval 1st) where 1st is a list of numbers and binary operators,which,when interpreted in prefix evaluate to a number. Your prefix evaluator needs to recognize the binary operators'+','-','*'and '/' as well as the unary operator 'chs'. 下面的例子可以做提示: (prefix-eval '(1)) 1 (prefix-eval '(+2 3)) 5 (prefix-eval '(+*+1 chs 2 3 ch 4)) 7 如果有高手能编出的,请与我联系。qius805@sina.com因为初涉及这个语言,所以想请高手支招~ 谢谢啦 |