f# - 为什么 F# 在我的最后一行“disp”函数中发现错误?
问题描述
let disp xs (d:float) =
match xs with
| [] -> ' ' // return the space char
| (a,b)::ts -> if(a > d)
then b // Found
else (disp ts d)
解决方案
您需要使用以下命令指示递归函数rec
:
let rec disp xs (d:float) =
match xs with
| [] -> ' ' // return the space char
| (a,b)::ts -> if(a > d)
then b // Found
else (disp ts d)
推荐阅读
- python - 为特定列中的每个唯一值创建所有其他列的列
- java - Intellij Idea 全文搜索仅在单元和集成测试类中?
- ios - 更改约束的第二项会将常量更改为负值
- symfony4 - 仅上传 PDF 文件时出现 CORS 问题
- azure - 带有 MessageReceiver 和 .NET 5 的 Azure 函数?
- asp.net-mvc - mvc中的布局控制器,不确定实现
- paypal - PayPal REST API v2/checkout/orders 在批准后不会重定向回来
- reactjs - 反应多阶段形式的记忆开关选择
- transformer - 推断张量引擎时Aoborted(核心转储)?
- python - Slicing where stop is larger than the string length