我正在尝试解决我在网上找到的Haskell课程的练习,对于this question,我有以下实现:
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.4/angular.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular-animate.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.13.3/ui-bootstrap.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.13.3/ui-bootstrap-tpls.js"></script>
<div ng-app="demoApp" ng-controller="mainController as mainCtrl">
<div class="main-navigation">
<div rt-tool-menus-"menus" selected="selectedMenus" tooltip="{{mainCtrl.displayName}}">Hover me to show tooltip!!!</div>
</div>
</div>
将reverse ::
List a
-> List a
reverse Nil = Nil
reverse (x :. xs) = let l = (reverse xs) in l ++ (x:.Nil)
定义为:
List
似乎这个函数里面有一个无限循环。但我找不到原因。你能开导我吗?
答案 0 :(得分:5)
对于练习册中reverse
的定义,这是List
的正确实现。如果某处存在无限循环,则可能是(++)
的实现。