TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Functional programming for Object Oriented programmers

75 点作者 lifebeyondfife超过 13 年前
With the continuing popularity of functional programming, it doesn't look like it's ever going away. Here's is an introduction to functional programming in F# written with the object oriented (C#) programmer in mind.

6 条评论

AndrewDucker超过 13 年前
My problem with these things (and I'm not picking on this particular article, just on introduction to functional programming articles in general) is that they always tell you how awesomely easy it is to make lists, or calculate the fibonacci sequence, two things I never have to do in the office.<p>What I want to know is whether functional programming languages would help me to write UIs better than C# does, to create XML documents from data, to retrieve data from web APIs and then display the results, etc.<p>These are things I have a need to do on a daily basis, and I'd like to know if F# is the tool for them, or if I should stick to C# unless I'm writing a list processor or calculation engine.
评论 #3275798 未加载
评论 #3274859 未加载
评论 #3274849 未加载
评论 #3274839 未加载
评论 #3275131 未加载
评论 #3274929 未加载
评论 #3274899 未加载
Zak超过 13 年前
The article says<p><i>List.map function list - Invokes function on every item within list and returns nothing.</i><p>which isn't what map does in other functional programming languages. Applying a function and returning nothing isn't a very functional thing to do in general, as whenever possible functions should be called for their return values, not anything else they might do[0]. Map normally returns a list of the function applied to every element of the list. I looked up the documentation for F#'s map, and it appears to do the same thing:<p><a href="http://msdn.microsoft.com/en-us/library/ee370378.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ee370378.aspx</a><p>[0] And when possible, a function should <i>only</i> return a value, not do other things.
评论 #3275095 未加载
评论 #3275042 未加载
xentronium超过 13 年前
I would recommend "Why functional programming matters"[1] paper to anyone struggling to understand the purpose of functional programming. It's only about 20 pages.<p>[1] <a href="http://web.mst.edu/~tauritzd/courses/cs347/whyfp.pdf" rel="nofollow">http://web.mst.edu/~tauritzd/courses/cs347/whyfp.pdf</a>
评论 #3276492 未加载
mjbellantoni超过 13 年前
"Functions are invoked without using brackets or commas"<p>Is this really a strict property of functional languages? :)
评论 #3275959 未加载
marshallp超过 13 年前
One thing missed in a big way by this article and other newbies when it comes to (static) functional programming is the centrality of types. It really is what makes ml-derived languages special and it's a shame it's not promoted to non-functional programmers more. Most of your work is related to specifying your types, the rest falls into place naturally, and is why you can think and write code elegantly (and is super fun).
评论 #3274809 未加载
评论 #3275259 未加载
josh5555超过 13 年前
great article...very useful. tyvm!