摆弄无点代码?
我一直在学习 Factor 和 J 语言来尝试无点编程。这些语言的基本机制似乎很清楚,但了解如何进行算法设计是一个挑战。
对我来说,一个特别令人困惑的地方是应该如何构建代码,以便可以轻松地尝试不同的参数。我的意思是 Mathematica 和 Matlab 非常擅长的事情;您设置一个算法,然后操纵变量并观察会发生什么。
在没有显式变量的情况下如何做到这一点?也许我对这一切的思考都是错误的。在无点编程中我应该如何解决这个问题?
I have been learning the Factor and J languages to experiment with point-free programming. The basic mechanics of the languages seem clear, but getting a feeling for how to approach algorithm design is a challenge.
A particular source of confusion for me is how one should structure code so that it is easy to experiment with different parameters. By this, I mean the sort of thing Mathematica and Matlab are so good at; you set up an algorithm then manipulate the variables and watch what happens.
How do you do this without explicit variables? Maybe I'm thinking about this all wrong. How should I approach this in point-free programming?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
以下是我发现在处理连接范例时非常有用的三个重要建议(在我的案例中适用于 Factor 编程语言):
一如既往,阅读并“走进”现有代码。在 Factor 中,探索运行时并查看事情是如何工作的非常容易。
对于您的具体混乱来源,如果您的算法中有很多输入参数,那么最重要的事情就是研究它们将如何使用。收获数据流模式。您必须真正考虑在最小的相关参数集上“安排”操作的最佳方法。
这是一次相当困难的经历,但成功时也是非常有益的。之后我们感觉自己就像一个人类编译器......
祝你好运!
Here are three important advices that I found really helpful while dealing with the concatenative paradigm (applied to the Factor programming language in my case):
And as a always, read and "Walk" into existing code. In Factor it is quite easy to explore the runtime and see how things are working.
For your specific source of confusion, if you have a lot of input parameters in your algorithm, the most important thing to do is to study how they will be used. Harvest for dataflow patterns. You must really THINK about the best way to "schedule" operations on the smallest set of related parameters.
It is a quite difficult experience, but it is also really rewarding one when it succeed. We feel like a human compiler after that..
Good luck!
我对串联编程语言 Joy 和 Backus 类似 FP< /a> 语言。关于算法设计,我可以说是一个非常结构化的算法设计。
事实上,像 Backus FP 这样的语言中没有全局变量。但是,没有什么可以阻止使用某些受限制的局部变量,例如实例变量。
I have had a little experience in the concatenative programming language Joy and in a Backus FP-like language. Regarding the algorithm design, I can say that it is a very structured algorithm design.
In fact, there are no global variables in languages like Backus FP. However, there is nothing to prevent the use of somewhat restricted local variables such as the instance variables.