Skip to content

Conversation

@TatooiNoyo
Copy link
Contributor

Added condition expression and loop part

Copy link
Member

@ryan4yin ryan4yin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感谢 PR,我补充了一些修改建议

Copy link
Contributor

@inclyc inclyc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update Manuals for Control Structures

总体上 Nix 语言作为纯函数式编程语言并不存在“控制流”,即所有的语言结构都是 expression ,不存在 statement.

@TatooiNoyo TatooiNoyo requested review from inclyc and ryan4yin June 24, 2024 07:43
Copy link
Contributor

@inclyc inclyc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

总体上我觉得没有必要在函数式编程语言中描写“如何用函数式模拟指令式”,这应该是 SICP 之类课程就已经学过的,只用介绍一下 if-then-else ,和介绍一些官方函数即可。

@TatooiNoyo
Copy link
Contributor Author

总体上我觉得没有必要在函数式编程语言中描写“如何用函数式模拟指令式”,这应该是 SICP 之类课程就已经学过的,只用介绍一下 if-then-else ,和介绍一些官方函数即可。

不是所有读者都系统性的学习过计算机专业的课程,更笼统的讲,读者可能不是工科专业。我觉得面向的读者的内容应该更加大众化。
国内流行的依旧是过程式编程范式,增加一些延伸的内容会好一些。毕竟,阅读能力强的会广泛收集信息;对于阅读能力弱但想涉及它的人就很糟糕了。

@inclyc
Copy link
Contributor

inclyc commented Jun 24, 2024

总体上我觉得没有必要在函数式编程语言中描写“如何用函数式模拟指令式”,这应该是 SICP 之类课程就已经学过的,只用介绍一下 if-then-else ,和介绍一些官方函数即可。

不是所有读者都系统性的学习过计算机专业的课程,更笼统的讲,读者可能不是工科专业。我觉得面向的读者的内容应该更加大众化。 国内流行的依旧是过程式编程范式,增加一些延伸的内容会好一些。毕竟,阅读能力强的会广泛收集信息;对于阅读能力弱但想涉及它的人就很糟糕了。

是这样没错,既然这种介绍这么重要,我们为什么不把他放到一个专门的章节,反而要把他和别的“表达式”并列呢?

#29 (comment)

@TatooiNoyo
Copy link
Contributor Author

TatooiNoyo commented Jun 24, 2024

总体上我觉得没有必要在函数式编程语言中描写“如何用函数式模拟指令式”,这应该是 SICP 之类课程就已经学过的,只用介绍一下 if-then-else ,和介绍一些官方函数即可。

不是所有读者都系统性的学习过计算机专业的课程,更笼统的讲,读者可能不是工科专业。我觉得面向的读者的内容应该更加大众化。 国内流行的依旧是过程式编程范式,增加一些延伸的内容会好一些。毕竟,阅读能力强的会广泛收集信息;对于阅读能力弱但想涉及它的人就很糟糕了。

是这样没错,既然这种介绍这么重要,我们为什么不把他放到一个专门的章节,反而要把他和别的“表达式”并列呢?

#29 (comment)

因为这仅是些 Example?其实是可以独立开一个专门章节的啦,但应该是其他PR的事情。这次的PR只是补上原有拟定的条件判断与循环控制空缺。

Co-authored-by: Yingchi Long <i@lyc.dev>
Copy link
Member

@ryan4yin ryan4yin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我重写了部分内容,看看各位意见。

@TatooiNoyo TatooiNoyo requested a review from inclyc June 26, 2024 03:11
@TatooiNoyo
Copy link
Contributor Author

我重写了部分内容,看看各位意见。

对循环控制这一部分的内容:补足了函数相关的参考链接,以及函数搜索渠道。采纳~

Co-authored-by: Ryan Yin <xiaoyin_c@qq.com>

这里举个简单的例子来说明 Nix 语言中如何实现一个递归函数:

> ⚠️注意:`nixpkgs.lib` 提供的函数对新手基本够用了,需要自行实现递归函数的场景并不多,在决定自行实现前,建议先检索下官方函数库。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个我不小心补了两遍,可以删掉。

另外前面部分内容格式化有点问题。
其他的我觉得没毛病了,等格式化的 PR 搞定后可以 merge.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

格式化问题交给prettier做吧,总归要自动格式化的。

Co-authored-by: Yingchi Long <i@lyc.dev>
Copy link
Contributor

@inclyc inclyc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Please wait for @ryan4yin's comments :)

@ryan4yin ryan4yin merged commit 534ab77 into NixOS-CN:main Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants