Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 2.rst #166

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion chp/2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,7 @@ Haskell 不使用 ``return`` 关键字来返回函数值:因为一个函数就

::

ghci> :load myDrop.hs
[1 of 1] Compiling Main ( myDrop.hs, interpreted )
Ok, modules loaded: Main.

Expand Down Expand Up @@ -680,7 +681,7 @@ Haskell 不使用 ``return`` 关键字来返回函数值:因为一个函数就

def myDrop(n, elts):
while n > 0 and elts:
n = n -1
n = n - 1
elts = elts[1:]
return elts

Expand Down Expand Up @@ -832,6 +833,10 @@ Haskell 使用了另外一种求值方式 —— *非严格*\ 求值。在这种

*Main> :type (1 - 1) <= 0
(1 - 1) <= 0 :: Bool
*Main> 1 - 1
0
*Main> 0 <= 0
True

最终,我们得出了一个 ``True`` 值!

Expand Down