哈斯克尔,范围downto没有步骤 [英] Haskell, range downto without step
本文介绍了哈斯克尔,范围downto没有步骤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么在Haskell不工作范围downto没有步骤
[7..1] => []
但仅限于此
[7,6..1] => [7,6,5,4,3,2,1]
解决方案
3.10。算术序列
[...]
算术序列满足这些身份:
- [...]
- [e1..e3] = enumFromTo e1 e3
- [...]
6.3.4 Enum类
对于Int和Integer类型,枚举函数具有以下含义:
- [...]
- 序列enumFromTo e1 e3是列表[e1,e1 + 1,e1 + 2,... e3]。如果e1> e3,则列表为空。
- [b]
Why in Haskell is not working range downto without step
[7..1] => []
but working only this
[7,6..1] => [7,6,5,4,3,2,1]
解决方案3.10. Arithmetic sequences
[...] Arithmetic sequences satisfy these identities:
- [...]
- [ e1..e3 ] = enumFromTo e1 e3
- [...]
6.3.4 The Enum Class
For the types Int and Integer, the enumeration functions have the following meaning:
- [...]
- The sequence enumFromTo e1 e3 is the list [e1,e1 + 1,e1 + 2,…e3]. The list is empty if e1 > e3.
- [...]
From Haskell 2010 Language Report.
这篇关于哈斯克尔,范围downto没有步骤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文