由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - functional programming?
相关主题
Haskell很难学。。1st class citizen
FP更接近人的思维我还是认为scala的程序员水平高
有没有喜欢haskell的同学clojure这语言真不错
对 (im)mutability 的误解和深度理解大牛给讲讲monad吧?
王垠新文 为Java说句公道话functional programming 哪本书经典适合入门
我对为什么使用FP的理解 (补)也谈OOP跟FP之争
模板算是纯FP吗OOP里面的Object其实是actor
批判 go怎么这里这么多人学python
相关话题的讨论汇总
话题: fp话题: java话题: haskell话题: functional话题: language
进入Programming版参与讨论
1 (共1页)
c******n
发帖数: 4965
1
I don't really see the point of using functional programming languages for
real production projects, though clojure is very popular now.
my point is that in a few cases you do need to operate on functions, all
languages have such features: C has function pointers, java has anonymous
inner classes, python has lambda. it's just that they do not openly
advertise them as "functional".
but even clojure itself does not recommend using non-named functions
recursive, but isn't operating on functions themselves the real power of
functional programming?
clojure is popular, and handy, but I feel a large part of that comes from
the easiness of kind of using java as a scripting language , so that u don't
need to go through the compile/build/run cycle, and the iteration is much
faster, kind of like for prototyping purposes. the only real difference of
clojure to java, I feel, is the annoying prefix notation, which is
completely useless, and the syntax could have been completely re-designed to
be like most languages to give users a more natural, intuitive feeling.
The prefix notation and endless "()" is just an archaic legacy left over
from when LISP was created.
d**********x
发帖数: 4083
2
铜球fp达人来解释

【在 c******n 的大作中提到】
: I don't really see the point of using functional programming languages for
: real production projects, though clojure is very popular now.
: my point is that in a few cases you do need to operate on functions, all
: languages have such features: C has function pointers, java has anonymous
: inner classes, python has lambda. it's just that they do not openly
: advertise them as "functional".
: but even clojure itself does not recommend using non-named functions
: recursive, but isn't operating on functions themselves the real power of
: functional programming?
: clojure is popular, and handy, but I feel a large part of that comes from

p*****2
发帖数: 21240
3
FP这几年越来越流行不就是主要因为parallelism 和 concurrency吗? 传统的
imperative programming不适合做并行计算。
n******t
发帖数: 4406
4
我认为fp比impertive language来说和当前实际计算机差得更远。
和一般人的思维也不那么接近,但是比较接近数学的思维。
所以相应的结果就是两个,第一效率不会很高,第二比较expressive。
最近的机器越来越快,所以fp开始流行起来了。

【在 p*****2 的大作中提到】
: FP这几年越来越流行不就是主要因为parallelism 和 concurrency吗? 传统的
: imperative programming不适合做并行计算。

p*****2
发帖数: 21240
5

基本这么回事。但是貌似不是机器越来越快造成的吧?机器越来越快已经持续很多年了
。相反是因为机器不能越来越快了,因此现在的趋势是core越来越多,所以fp流行起来
了。

【在 n******t 的大作中提到】
: 我认为fp比impertive language来说和当前实际计算机差得更远。
: 和一般人的思维也不那么接近,但是比较接近数学的思维。
: 所以相应的结果就是两个,第一效率不会很高,第二比较expressive。
: 最近的机器越来越快,所以fp开始流行起来了。

x****u
发帖数: 44466
6
core多不会提高fp速度啊。现实点说,不在乎速度的场合才能用FP。

【在 p*****2 的大作中提到】
:
: 基本这么回事。但是貌似不是机器越来越快造成的吧?机器越来越快已经持续很多年了
: 。相反是因为机器不能越来越快了,因此现在的趋势是core越来越多,所以fp流行起来
: 了。

p*****2
发帖数: 21240
7

core多就需要更好的并行计算了。FP在单线程上确实效率没法跟OO的比,但是多线程具
有先天的优势。这也是为什么随着core越来越多,fp越来越流行的真正原因。

【在 x****u 的大作中提到】
: core多不会提高fp速度啊。现实点说,不在乎速度的场合才能用FP。
x****u
发帖数: 44466
8
FP和并行有什么关系。

【在 p*****2 的大作中提到】
:
: core多就需要更好的并行计算了。FP在单线程上确实效率没法跟OO的比,但是多线程具
: 有先天的优势。这也是为什么随着core越来越多,fp越来越流行的真正原因。

p*****2
发帖数: 21240
9

imperative对并行计算有先天的缺陷呀。这些缺陷FP上都没有呀。如果你这个还有疑问
的话,最好先看看FP的基本概念。

【在 x****u 的大作中提到】
: FP和并行有什么关系。
x****u
发帖数: 44466
10
先天缺陷什么啊,VC都支持lambda了。

【在 p*****2 的大作中提到】
:
: imperative对并行计算有先天的缺陷呀。这些缺陷FP上都没有呀。如果你这个还有疑问
: 的话,最好先看看FP的基本概念。

相关主题
我对为什么使用FP的理解 (补)1st class citizen
模板算是纯FP吗我还是认为scala的程序员水平高
批判 goclojure这语言真不错
进入Programming版参与讨论
p*****2
发帖数: 21240
11

这个跟lambda没啥关系。支持lambada的语言多了,有几个敢说自己是FP呢?

【在 x****u 的大作中提到】
: 先天缺陷什么啊,VC都支持lambda了。
n******t
发帖数: 4406
12
每一个core不能变快,但是对于大部分应用还是太快。
所以core多,和处理能力强很多时候是一样的。
此外,大部分fp对list和vector支持比较好,所以对于自然并行化的
问题,比较容易scale.

【在 p*****2 的大作中提到】
:
: 这个跟lambda没啥关系。支持lambada的语言多了,有几个敢说自己是FP呢?

p*****2
发帖数: 21240
13

core多也需要application的优化才能转化为更好的性能。即使在OS的level也需要支持
multi core,不然也获得不了应有的benefit。OS支持了,你可以认为处理能力更强了
。但是那是从OS的角度来说的。从application角度也需要支持multi core,否则这个
application就没有take multi core的benefit。而FP正是从application level来讲的
。显然FP做不了底层。

【在 n******t 的大作中提到】
: 每一个core不能变快,但是对于大部分应用还是太快。
: 所以core多,和处理能力强很多时候是一样的。
: 此外,大部分fp对list和vector支持比较好,所以对于自然并行化的
: 问题,比较容易scale.

p*****2
发帖数: 21240
14

关键不是对list vector支持好。

【在 n******t 的大作中提到】
: 每一个core不能变快,但是对于大部分应用还是太快。
: 所以core多,和处理能力强很多时候是一样的。
: 此外,大部分fp对list和vector支持比较好,所以对于自然并行化的
: 问题,比较容易scale.

n******t
发帖数: 4406
15
fp常常是用来计算已经被分拆之后的task,也就是一个core上跑的任务。

【在 p*****2 的大作中提到】
:
: 关键不是对list vector支持好。

p*****2
发帖数: 21240
16

拆分之后为什么只在一个core上跑?

【在 n******t 的大作中提到】
: fp常常是用来计算已经被分拆之后的task,也就是一个core上跑的任务。
x****u
发帖数: 44466
17
VC支持lambda是为了应对多核,和FP没关系。

【在 p*****2 的大作中提到】
:
: 拆分之后为什么只在一个core上跑?

x****u
发帖数: 44466
18
不说别的,OS启动这一块的支持就不好。

【在 n******t 的大作中提到】
: 每一个core不能变快,但是对于大部分应用还是太快。
: 所以core多,和处理能力强很多时候是一样的。
: 此外,大部分fp对list和vector支持比较好,所以对于自然并行化的
: 问题,比较容易scale.

t****a
发帖数: 1212
19
I don't really see the point of using functional programming languages for
real production projects, though clojure is very popular now.
好问题,但也许你尝试用FP语言做一做事情,亲身体验一下,会有不同的感觉。
my point is that in a few cases you do need to operate on functions, all
languages have such features: C has function pointers, java has anonymous
inner classes, python has lambda. it's just that they do not openly
advertise them as "functional".
FP和上述冯诺依曼机式语言有好些地方不一样。最主要之一是immutable的数据结构。
个人的体会是它使得写程序减少了变量,强迫程序员用类似数学推理的方式写程序,提
高了程序的正确性。
在写Clojure程序的时候,我的体会是应该考虑“是什么”,而不是“怎么做”,这点
和冯诺依曼机式语言明显不同。
but even clojure itself does not recommend using non-named functions
recursive, but isn't operating on functions themselves the real power of
functional programming?
真的吗?我没看到这个recommend,能给个出处好么?我通常用anonymous function和
map函数配合,譬如(map #(+ x 2) (list 1 2 3)),如果有其他推荐的方法,请教教我。
clojure is popular, and handy, but I feel a large part of that comes from
the easiness of kind of using java as a scripting language , so that u don't
need to go through the compile/build/run cycle, and the iteration is much
faster, kind of like for prototyping purposes. the only real difference of
clojure to java, I feel, is the annoying prefix notation, which is
completely useless, and the syntax could have been completely re-designed to
be like most languages to give users a more natural, intuitive feeling.
The prefix notation and endless "()" is just an archaic legacy left over
from when LISP was created.
JVM的scripting language由来已久。如果你喜欢偏java格式的语法,可以尝试
beanshell, groovy。你也有其他选择比如Jython, JRuby。
简单就是美。Prefix notation使得Lisp/Clojure用统一的格式,不受语法的限制,个
人以为这正是它美的地方。而且,如果没有了Prefix notation,还如何能使用macro,
operate code as data呢?
刚接触Lisp的同学可能会有些排斥lisp古怪的括号。当你习惯了它的时候,你会喜欢上
它的。
心得:
1. 你需要一个好的编辑器,推荐emacs。NREPL,或者slime+swank-clojure让我感觉超
越了python, R的交互环境,也许你也会这么觉得。
2. 手工配对括号是很麻烦的事情,需要自动配对工具。在emacs下推荐paredit +
rainbow-delimiter。
b*****n
发帖数: 482
20
scala 中一个 par 指令就可以做并行运算了。

【在 n******t 的大作中提到】
: fp常常是用来计算已经被分拆之后的task,也就是一个core上跑的任务。
相关主题
大牛给讲讲monad吧?OOP里面的Object其实是actor
functional programming 哪本书经典适合入门怎么这里这么多人学python
也谈OOP跟FP之争粉FP的人是因为把电脑想象成图灵机了
进入Programming版参与讨论
x****u
发帖数: 44466
21
FP除了效率不行外,没有任何缺点。

【在 t****a 的大作中提到】
: I don't really see the point of using functional programming languages for
: real production projects, though clojure is very popular now.
: 好问题,但也许你尝试用FP语言做一做事情,亲身体验一下,会有不同的感觉。
: my point is that in a few cases you do need to operate on functions, all
: languages have such features: C has function pointers, java has anonymous
: inner classes, python has lambda. it's just that they do not openly
: advertise them as "functional".
: FP和上述冯诺依曼机式语言有好些地方不一样。最主要之一是immutable的数据结构。
: 个人的体会是它使得写程序减少了变量,强迫程序员用类似数学推理的方式写程序,提
: 高了程序的正确性。

p*****2
发帖数: 21240
22

大牛终于出现了。

【在 t****a 的大作中提到】
: I don't really see the point of using functional programming languages for
: real production projects, though clojure is very popular now.
: 好问题,但也许你尝试用FP语言做一做事情,亲身体验一下,会有不同的感觉。
: my point is that in a few cases you do need to operate on functions, all
: languages have such features: C has function pointers, java has anonymous
: inner classes, python has lambda. it's just that they do not openly
: advertise them as "functional".
: FP和上述冯诺依曼机式语言有好些地方不一样。最主要之一是immutable的数据结构。
: 个人的体会是它使得写程序减少了变量,强迫程序员用类似数学推理的方式写程序,提
: 高了程序的正确性。

p*****2
发帖数: 21240
23

这个不是这样子的吧?lambda本来就是fp的东西吧?怎么能说没关系呢?

【在 x****u 的大作中提到】
: VC支持lambda是为了应对多核,和FP没关系。
p*****2
发帖数: 21240
24

这个不一定吧?
FP效率不高并不是绝对的,而且在并行计算有先天的优势。效率应该比imperative的更
高才对。
FP的缺点其实也不少,不然OO早被干掉了。

【在 x****u 的大作中提到】
: FP除了效率不行外,没有任何缺点。
x****u
发帖数: 44466
25
匿名函数和fp没什么必然联系。

【在 p*****2 的大作中提到】
:
: 这个不一定吧?
: FP效率不高并不是绝对的,而且在并行计算有先天的优势。效率应该比imperative的更
: 高才对。
: FP的缺点其实也不少,不然OO早被干掉了。

x****u
发帖数: 44466
26
就算是并行,分到每个核上面还是冯诺依曼架构。

【在 p*****2 的大作中提到】
:
: 这个不一定吧?
: FP效率不高并不是绝对的,而且在并行计算有先天的优势。效率应该比imperative的更
: 高才对。
: FP的缺点其实也不少,不然OO早被干掉了。

p*****2
发帖数: 21240
27

这个有什么根据吗?

【在 x****u 的大作中提到】
: 匿名函数和fp没什么必然联系。
p*****2
发帖数: 21240
28

但是并行以后性能可以提升呀。所以不是FP就性能一定差呀。

【在 x****u 的大作中提到】
: 就算是并行,分到每个核上面还是冯诺依曼架构。
x****u
发帖数: 44466
29
FP的问题是计算量越大,CPU越不是图灵机。

【在 p*****2 的大作中提到】
:
: 但是并行以后性能可以提升呀。所以不是FP就性能一定差呀。

p*****2
发帖数: 21240
30

这是刚从wiki上查的
First class functions have slowly been added to mainstream languages. For
example, in early 1994, support for lambda, filter, map, and reduce was
added to Python. Then during the development of Python 3000, Guido van
Rossum called for the removal of these features.[40][41] So far, only the
reduce function has been removed, but remains accessible via the functools
standard library module.[42] First class functions were also introduced in
PHP 5.3, Visual Basic 9, C# 3.0, and C++11.
The Language Integrated Query (LINQ) feature, with its many incarnations, is
an obvious and powerful use of functional programming in .NET.

【在 x****u 的大作中提到】
: 匿名函数和fp没什么必然联系。
相关主题
学FP不是为了写代码, 而是为了优秀的架构.FP更接近人的思维
go几天的一些感受有没有喜欢haskell的同学
Haskell很难学。。对 (im)mutability 的误解和深度理解
进入Programming版参与讨论
p*****2
发帖数: 21240
31

太高深了。不明白。跟我们讨论的并行有什么关系吗?

【在 x****u 的大作中提到】
: FP的问题是计算量越大,CPU越不是图灵机。
x****u
发帖数: 44466
32
这是什么乱七八糟的。JavaScript也支持匿名函数,莫非JS也是FP?

is

【在 p*****2 的大作中提到】
:
: 太高深了。不明白。跟我们讨论的并行有什么关系吗?

x****u
发帖数: 44466
33
就是说FP在极端条件下不好用,因为整个架构就不是为它设计的。你要是用过以前的计
算机就明白了。

【在 p*****2 的大作中提到】
:
: 太高深了。不明白。跟我们讨论的并行有什么关系吗?

p*****2
发帖数: 21240
34

好了。终于明白你的逻辑了。I服了Y。

【在 x****u 的大作中提到】
: 这是什么乱七八糟的。JavaScript也支持匿名函数,莫非JS也是FP?
:
: is

x****u
发帖数: 44466
35
你悲愤也没用。
90年代的C++也支持匿名函数,只要按照COM的Automation规范写即可。

【在 p*****2 的大作中提到】
:
: 好了。终于明白你的逻辑了。I服了Y。

g*****g
发帖数: 34805
36
FP的最大缺点,不是慢,而是太难。太难的语言,想找够人写个大项目都不可能,想找
个有10年经验的来带项目市面上不存在。
不是没有例外呀,Erlang就算一个。但例外终究是例外,不是主流。
x****u
发帖数: 44466
37
就是一个慢。想快的话就不能顺着FP的自然思路写,那就是自己整自己了。

【在 g*****g 的大作中提到】
: FP的最大缺点,不是慢,而是太难。太难的语言,想找够人写个大项目都不可能,想找
: 个有10年经验的来带项目市面上不存在。
: 不是没有例外呀,Erlang就算一个。但例外终究是例外,不是主流。

g*****g
发帖数: 34805
38
Scala的性能接近Java,比Python, Ruby之类的scripting语言快,不能算慢了。

【在 x****u 的大作中提到】
: 就是一个慢。想快的话就不能顺着FP的自然思路写,那就是自己整自己了。
x****u
发帖数: 44466
39
做个大东西,就有差距了。类似的例子任何两个语言都能找出来。

【在 g*****g 的大作中提到】
: Scala的性能接近Java,比Python, Ruby之类的scripting语言快,不能算慢了。
g*****g
发帖数: 34805
40
性能不是唯一重要的东西,特别差别没超过一个数量级的情况下。就如java性能永远比
不上C++,照样在很多领域取代C++没有压力。开发快速,维护容易,永远是最重要的。
FP简洁是做到了,是否快速要看什么领域。

【在 x****u 的大作中提到】
: 做个大东西,就有差距了。类似的例子任何两个语言都能找出来。
相关主题
对 (im)mutability 的误解和深度理解模板算是纯FP吗
王垠新文 为Java说句公道话批判 go
我对为什么使用FP的理解 (补)1st class citizen
进入Programming版参与讨论
x****u
发帖数: 44466
41
所以说JavaScript也能长盛不衰,主要是特定场合有特定用处。

【在 g*****g 的大作中提到】
: 性能不是唯一重要的东西,特别差别没超过一个数量级的情况下。就如java性能永远比
: 不上C++,照样在很多领域取代C++没有压力。开发快速,维护容易,永远是最重要的。
: FP简洁是做到了,是否快速要看什么领域。

t*s
发帖数: 1504
42
最近在学Haskell
看learn yourself a haskell七八章了。到现在为止没看到Python没有的feature.
Python里面partial, list comprehension, map, reduce, filter都有
什么Eq Ord Show这种Python也有,例如, 一个类如果定义了 __lt__ 等等就能比较
所谓Monad也是故弄玄虚,我专门去看了Philp Wadler (principle designer of
Haskell)的Monads for functional programming。Monad两个字就能解释: annotated
data. 顶多把那三个laws再加上。
Maybe有点意思,但imperative的Exceptional Handling更方便,更有效率。
最不爽的是Haskell readability sucks。
唯一Haskell比Python舒服的地方我觉得是函数定义强制
->a->a->a->b 这个背后的点子非常聪明,非常mathematically beautiful
另外就是匹配中的_符号很符合数学规范。

【在 c******n 的大作中提到】
: I don't really see the point of using functional programming languages for
: real production projects, though clojure is very popular now.
: my point is that in a few cases you do need to operate on functions, all
: languages have such features: C has function pointers, java has anonymous
: inner classes, python has lambda. it's just that they do not openly
: advertise them as "functional".
: but even clojure itself does not recommend using non-named functions
: recursive, but isn't operating on functions themselves the real power of
: functional programming?
: clojure is popular, and handy, but I feel a large part of that comes from

s***o
发帖数: 2191
43
刚跟stackoverflow上的“专家”交流了一下关于Java8跟Scala,专家坚持认为java is
slow, slow, slow...
"chat with an expert" 是stackoverflow 今天推出来的一个新服务,有兴趣的可以去
试一试

【在 g*****g 的大作中提到】
: Scala的性能接近Java,比Python, Ruby之类的scripting语言快,不能算慢了。
E*****m
发帖数: 25615
44

行行行! 你回去拜耶穌比你講你不懂的圖靈機實際點。

【在 x****u 的大作中提到】
: FP的问题是计算量越大,CPU越不是图灵机。
E*****m
发帖数: 25615
45
Abstract data type, pattern matching, guard, laziness...
你用 Python 做這些看看。

annotated

【在 t*s 的大作中提到】
: 最近在学Haskell
: 看learn yourself a haskell七八章了。到现在为止没看到Python没有的feature.
: Python里面partial, list comprehension, map, reduce, filter都有
: 什么Eq Ord Show这种Python也有,例如, 一个类如果定义了 __lt__ 等等就能比较
: 所谓Monad也是故弄玄虚,我专门去看了Philp Wadler (principle designer of
: Haskell)的Monads for functional programming。Monad两个字就能解释: annotated
: data. 顶多把那三个laws再加上。
: Maybe有点意思,但imperative的Exceptional Handling更方便,更有效率。
: 最不爽的是Haskell readability sucks。
: 唯一Haskell比Python舒服的地方我觉得是函数定义强制

d****i
发帖数: 4809
46
OpenMP不就是为了多核并行计算提出来的吗?

【在 p*****2 的大作中提到】
: FP这几年越来越流行不就是主要因为parallelism 和 concurrency吗? 传统的
: imperative programming不适合做并行计算。

E*****m
发帖数: 25615
47

沒哪個語言不能做並行,好不好做的差別而已。

【在 d****i 的大作中提到】
: OpenMP不就是为了多核并行计算提出来的吗?
e*******o
发帖数: 4654
48
直接从clojure doc 上拿个例子。
(((person :employer) :address) :city)
clojure 提供了个 macro ->
所以可以这样写。
(-> person :employer :address :city)
在别的语言中,大致类似的写法是 person.employer.address.city
你喜欢哪个写法? 这个例子说明什么呢?

【在 t****a 的大作中提到】
: I don't really see the point of using functional programming languages for
: real production projects, though clojure is very popular now.
: 好问题,但也许你尝试用FP语言做一做事情,亲身体验一下,会有不同的感觉。
: my point is that in a few cases you do need to operate on functions, all
: languages have such features: C has function pointers, java has anonymous
: inner classes, python has lambda. it's just that they do not openly
: advertise them as "functional".
: FP和上述冯诺依曼机式语言有好些地方不一样。最主要之一是immutable的数据结构。
: 个人的体会是它使得写程序减少了变量,强迫程序员用类似数学推理的方式写程序,提
: 高了程序的正确性。

t*s
发帖数: 1504
49
python的duck type更general.
pattern matching在imperative语言中根本不是问题。也更灵活。
不光可以pattern matching, 还可以value matching
laziness python也有, generator.
guard是啥不知道

【在 E*****m 的大作中提到】
: Abstract data type, pattern matching, guard, laziness...
: 你用 Python 做這些看看。
:
: annotated

t****a
发帖数: 1212
50
我看到的多数人采用->的写法,它的好处可能有
1. 减少了小括号的数目
这是Clojure比Common Lisp改进的方向。Clojure在语言设计上已经想办法减少()的数
目。
2. 提高可读性。
这种写法有点像OOP语言里访问成员的方式。联想到很多Clojure程序员是从Java语言转
过来的,很多人喜欢这样写也就很自然了。

【在 e*******o 的大作中提到】
: 直接从clojure doc 上拿个例子。
: (((person :employer) :address) :city)
: clojure 提供了个 macro ->
: 所以可以这样写。
: (-> person :employer :address :city)
: 在别的语言中,大致类似的写法是 person.employer.address.city
: 你喜欢哪个写法? 这个例子说明什么呢?

相关主题
我还是认为scala的程序员水平高functional programming 哪本书经典适合入门
clojure这语言真不错也谈OOP跟FP之争
大牛给讲讲monad吧?OOP里面的Object其实是actor
进入Programming版参与讨论
p*****2
发帖数: 21240
51
一个最基本的尾递归就把python秒了吧

annotated

【在 t*s 的大作中提到】
: 最近在学Haskell
: 看learn yourself a haskell七八章了。到现在为止没看到Python没有的feature.
: Python里面partial, list comprehension, map, reduce, filter都有
: 什么Eq Ord Show这种Python也有,例如, 一个类如果定义了 __lt__ 等等就能比较
: 所谓Monad也是故弄玄虚,我专门去看了Philp Wadler (principle designer of
: Haskell)的Monads for functional programming。Monad两个字就能解释: annotated
: data. 顶多把那三个laws再加上。
: Maybe有点意思,但imperative的Exceptional Handling更方便,更有效率。
: 最不爽的是Haskell readability sucks。
: 唯一Haskell比Python舒服的地方我觉得是函数定义强制

E*****m
发帖数: 25615
52

這怎麼來的?
你到底讀了那本書沒有? 我覺得你沒有。
我說的 pattern matching 是這種
sum [] = 0
sum x:xs = x + sum xs
python 的太有限, 你看看這個經典算 Fibonacci series 的
fibs :: [Integer]
fibs = 1:1:zipwith (+) fibs (tail fibs)
python 做不到這麼精簡的
Learn You a Haskell for Great Good! 第四章
我不是Python 黑,事實上我是Python 粉, 不過各有
長處罷了。

【在 t*s 的大作中提到】
: python的duck type更general.
: pattern matching在imperative语言中根本不是问题。也更灵活。
: 不光可以pattern matching, 还可以value matching
: laziness python也有, generator.
: guard是啥不知道

A*******t
发帖数: 443
53
您学过theory of computation或者mathematical logic吗?

【在 x****u 的大作中提到】
: FP的问题是计算量越大,CPU越不是图灵机。
A*******t
发帖数: 443
54
求问GADT, template Haskell, type based reflection, quasiquoting 在python里面
是咋做的。

【在 t*s 的大作中提到】
: python的duck type更general.
: pattern matching在imperative语言中根本不是问题。也更灵活。
: 不光可以pattern matching, 还可以value matching
: laziness python也有, generator.
: guard是啥不知道

E*****m
发帖数: 25615
55

他上次已經發貼曝露他沒搞懂啥教 Turing Machine 了。

【在 A*******t 的大作中提到】
: 您学过theory of computation或者mathematical logic吗?
L***n
发帖数: 6727
56
那位就是灌水扯淡的

【在 E*****m 的大作中提到】
:
: 他上次已經發貼曝露他沒搞懂啥教 Turing Machine 了。

E*****m
发帖数: 25615
57
他是信耶穌的, 凡事講信仰,不講證據。

【在 L***n 的大作中提到】
: 那位就是灌水扯淡的
t*s
发帖数: 1504
58
google了一下
这个是haskell编译懂得优化,还是需要人为的写,例如用fold?
如果是用fold, python也有,但只是从左到右
要reverse效率会下降。

【在 p*****2 的大作中提到】
: 一个最基本的尾递归就把python秒了吧
:
: annotated

t*s
发帖数: 1504
59
一个都没听说过

【在 A*******t 的大作中提到】
: 求问GADT, template Haskell, type based reflection, quasiquoting 在python里面
: 是咋做的。

e*******o
发帖数: 4654
60
我开始看的时候也没懂pattern matching。
-----------
我也秀几个fibs,从长到短。
@fibs1 := 1, 1, -> $a, $b { $a + $b } ... * ;
@fibs2 := 1, 1, {$^a + $^b } ... * ;
@fibs3 := 1, 1, * + * ... * ;
@fibs4 := 1, 1, &[+] ... * ;
这就是臭名昭著的perl6。
perl6 也支持pattern matching的。

【在 E*****m 的大作中提到】
: 他是信耶穌的, 凡事講信仰,不講證據。
相关主题
怎么这里这么多人学pythongo几天的一些感受
粉FP的人是因为把电脑想象成图灵机了Haskell很难学。。
学FP不是为了写代码, 而是为了优秀的架构.FP更接近人的思维
进入Programming版参与讨论
t*s
发帖数: 1504
61
sum [] = 0
sum x:xs = x + sum xs
我说的就是这种,这类型的在python/c/java里面就是if if 的事情
if 还不光看pattern, value也能一并看了。
fibs :: [Integer]
fibs = 1:1:zipwith (+) fibs (tail fibs)
python里面yield from, yield来构建generator也很方便,例如
def fibs():
a,b=1,1
yield from (a,b)
while True:
a,b=b,a+b
yield b
guard我去看了一下,这也叫feature? 难怪我不记得。就是switch case case

【在 E*****m 的大作中提到】
: 他是信耶穌的, 凡事講信仰,不講證據。
g****r
发帖数: 1589
62
Functional Language都出来40年了,很多概念模式被其他语言也吸收了不少,比如JS
和C#里就有大量Functional的feature和用法,估计Python里应该也有不少吧
imperative语言的特点就是你告诉计算机怎么去做一件事,if..else就是告诉计算机先
比较这俩数,如果true就干这个事;functional的特点就是只告诉计算机要完成的任务
是啥,pattern matching就是定义一个函数,然后计算机来帮你分析执行;我感觉
functional的写法还是更high level、更简洁一点,当然区别可能也没那么大,所以很
多人觉得这是脱裤子放屁
要说实现都能实现,有啥不能实现的,用汇编也就是几个CMP,JNE
说来也就是你喜欢那种,那个效率高,对于某些特定的问题哪个更有优势。通用语言肯
定还是用得最广的,但通用语言也是不断的在加入Functional Programming的概念,以
后我觉得也是multi paradigm语言的有点前途,比如F#和Scala这种,纯粹的
Functional Language比如haskell,我觉得很难在工业界流行开来,当然作为业余爱好
,搞点小东西,作为学习研究对象还是有价值的

【在 t*s 的大作中提到】
: sum [] = 0
: sum x:xs = x + sum xs
: 我说的就是这种,这类型的在python/c/java里面就是if if 的事情
: if 还不光看pattern, value也能一并看了。
: fibs :: [Integer]
: fibs = 1:1:zipwith (+) fibs (tail fibs)
: python里面yield from, yield来构建generator也很方便,例如
: def fibs():
: a,b=1,1
: yield from (a,b)

E*****m
发帖数: 25615
63

沒什麼是 Python (或任何 TM-complete 語言) 一定做不到的,差別
就是簡潔易懂否, 你那個 fibs 例子就長了幾倍,不是嗎?
還有個 laziness 的例子 python 更難做的, 用 sieve 來求質數
primesT = sieve [2..] where
sieve (p:xs) = p : sieve [x | x <- xs, rem x p /= 0]
然後求前 100 個質數就是
take 100 primesT
當然, 我不否認不是所有東西都需要 laziness,只是有時 laziness
會讓題目比較好解。

【在 t*s 的大作中提到】
: sum [] = 0
: sum x:xs = x + sum xs
: 我说的就是这种,这类型的在python/c/java里面就是if if 的事情
: if 还不光看pattern, value也能一并看了。
: fibs :: [Integer]
: fibs = 1:1:zipwith (+) fibs (tail fibs)
: python里面yield from, yield来构建generator也很方便,例如
: def fibs():
: a,b=1,1
: yield from (a,b)

w****w
发帖数: 521
64
给个简单例子:
20年前,你写了个复杂的SQL query,在当时的sql server上要运行2个月。现在同样的
query用不同的硬件和database engine,两秒钟就出来了。FP只告诉计算机要什么,至
于怎么做就不管了。系统软件硬件发展越快,FP的优势就会越来越明显。
p*****2
发帖数: 21240
65

JS
大牛说的很好。

【在 g****r 的大作中提到】
: Functional Language都出来40年了,很多概念模式被其他语言也吸收了不少,比如JS
: 和C#里就有大量Functional的feature和用法,估计Python里应该也有不少吧
: imperative语言的特点就是你告诉计算机怎么去做一件事,if..else就是告诉计算机先
: 比较这俩数,如果true就干这个事;functional的特点就是只告诉计算机要完成的任务
: 是啥,pattern matching就是定义一个函数,然后计算机来帮你分析执行;我感觉
: functional的写法还是更high level、更简洁一点,当然区别可能也没那么大,所以很
: 多人觉得这是脱裤子放屁
: 要说实现都能实现,有啥不能实现的,用汇编也就是几个CMP,JNE
: 说来也就是你喜欢那种,那个效率高,对于某些特定的问题哪个更有优势。通用语言肯
: 定还是用得最广的,但通用语言也是不断的在加入Functional Programming的概念,以

l*********s
发帖数: 5409
66
enlightening

JS

【在 g****r 的大作中提到】
: Functional Language都出来40年了,很多概念模式被其他语言也吸收了不少,比如JS
: 和C#里就有大量Functional的feature和用法,估计Python里应该也有不少吧
: imperative语言的特点就是你告诉计算机怎么去做一件事,if..else就是告诉计算机先
: 比较这俩数,如果true就干这个事;functional的特点就是只告诉计算机要完成的任务
: 是啥,pattern matching就是定义一个函数,然后计算机来帮你分析执行;我感觉
: functional的写法还是更high level、更简洁一点,当然区别可能也没那么大,所以很
: 多人觉得这是脱裤子放屁
: 要说实现都能实现,有啥不能实现的,用汇编也就是几个CMP,JNE
: 说来也就是你喜欢那种,那个效率高,对于某些特定的问题哪个更有优势。通用语言肯
: 定还是用得最广的,但通用语言也是不断的在加入Functional Programming的概念,以

c******n
发帖数: 4965
67
I think a big problem with the FP camp is that they keep peddling the old
stuff, which, as you said, may be brilliant in the 60's, but are so common
today that the listener find it hard to understand why the FP enthusiasts
say it's a big deal.
FP camp should look at the world today and sell the true deltas above other
languages.

JS

【在 g****r 的大作中提到】
: Functional Language都出来40年了,很多概念模式被其他语言也吸收了不少,比如JS
: 和C#里就有大量Functional的feature和用法,估计Python里应该也有不少吧
: imperative语言的特点就是你告诉计算机怎么去做一件事,if..else就是告诉计算机先
: 比较这俩数,如果true就干这个事;functional的特点就是只告诉计算机要完成的任务
: 是啥,pattern matching就是定义一个函数,然后计算机来帮你分析执行;我感觉
: functional的写法还是更high level、更简洁一点,当然区别可能也没那么大,所以很
: 多人觉得这是脱裤子放屁
: 要说实现都能实现,有啥不能实现的,用汇编也就是几个CMP,JNE
: 说来也就是你喜欢那种,那个效率高,对于某些特定的问题哪个更有优势。通用语言肯
: 定还是用得最广的,但通用语言也是不断的在加入Functional Programming的概念,以

t****a
发帖数: 1212
68
你能否说具体一点?比如哪些是old stuff,brilliant in the 60's但是今天so
common?如果你说的是你原文中给出的那些材料,那么这些回帖里面已经说的很清楚了
:今天的language并没有完全实现那些feature。
另外,FP中有趣的概念很多,不仅仅是你的帖子中说到的那些。

other

【在 c******n 的大作中提到】
: I think a big problem with the FP camp is that they keep peddling the old
: stuff, which, as you said, may be brilliant in the 60's, but are so common
: today that the listener find it hard to understand why the FP enthusiasts
: say it's a big deal.
: FP camp should look at the world today and sell the true deltas above other
: languages.
:
: JS

t****a
发帖数: 1212
69
市场上可用的语言越来越多是不争的事实。通用语言可以保证容易找到饭碗,专用语言
在专有领域具有优势。
另外FP和Imperative语言的差别..个人觉得还是蛮大的,最主要的是会改变程序员思考
问题的方式。
如果哪个程序员说他很随意的在纯FP语言和纯Imperative语言之间转换思维,从而总是
能在合适的地方用最适合的方式,那倒真是令人佩服。

JS

【在 g****r 的大作中提到】
: Functional Language都出来40年了,很多概念模式被其他语言也吸收了不少,比如JS
: 和C#里就有大量Functional的feature和用法,估计Python里应该也有不少吧
: imperative语言的特点就是你告诉计算机怎么去做一件事,if..else就是告诉计算机先
: 比较这俩数,如果true就干这个事;functional的特点就是只告诉计算机要完成的任务
: 是啥,pattern matching就是定义一个函数,然后计算机来帮你分析执行;我感觉
: functional的写法还是更high level、更简洁一点,当然区别可能也没那么大,所以很
: 多人觉得这是脱裤子放屁
: 要说实现都能实现,有啥不能实现的,用汇编也就是几个CMP,JNE
: 说来也就是你喜欢那种,那个效率高,对于某些特定的问题哪个更有优势。通用语言肯
: 定还是用得最广的,但通用语言也是不断的在加入Functional Programming的概念,以

g*****g
发帖数: 34805
70
说Java慢看跟什么比,跟C比自然是慢的。我见过的benchmark,都比Scala快一点。

is

【在 s***o 的大作中提到】
: 刚跟stackoverflow上的“专家”交流了一下关于Java8跟Scala,专家坚持认为java is
: slow, slow, slow...
: "chat with an expert" 是stackoverflow 今天推出来的一个新服务,有兴趣的可以去
: 试一试

相关主题
FP更接近人的思维王垠新文 为Java说句公道话
有没有喜欢haskell的同学我对为什么使用FP的理解 (补)
对 (im)mutability 的误解和深度理解模板算是纯FP吗
进入Programming版参与讨论
s***o
发帖数: 2191
71
that's a stackoverflow "new feature" available on April 1 :)
不过我的确是去看java 8对scala能造成啥影响的话题的。好虫说一下,scala还有没有
成为主流的可能,或者一直这么不温不火下去?

【在 g*****g 的大作中提到】
: 说Java慢看跟什么比,跟C比自然是慢的。我见过的benchmark,都比Scala快一点。
:
: is

x****u
发帖数: 44466
72
你这就不是扯淡,是发paper。

【在 L***n 的大作中提到】
: 那位就是灌水扯淡的
a*****e
发帖数: 1700
73
你有这样的感觉没错,Python 的这些概念都来源于 FP,事实上,从 Lisp 引入 GC 开
始,非常多的 FP 的特征,已经越来越普遍地进入到其它非 FP 的语言。
我想你要问的是,既然这样,为什么要学习 Haskell 或者 FP?
我给几个 Haskell 有,但是你在 python 里面学不到的东西吧:
1. Strong type system
duck typing 看似更灵活,但是实际上它只是一个 sum of all types,没办法保证
type safty。有时候更 general 不是好事情,反而是有限制,尤其是编译器能够通过
静态检查就能确保程序遵守了这些限制,更有益处。举个例子,很多语言都有 SQL 的
库可用,但有几个能够静态检查,确保所有发出的 SQL 查询都是合法的?再比如,一
个程序需要处理平衡二叉树,你能够通过静态检查就确保不会发生不平衡的情况出现吗
?这些只有强类型的 abstract datatype 才能做到。
如果你要进一步学习 type system,那么 LYAH 这本书是不够的,需要看一些程序语言
的教科书。
2. Monad
首先,这个概念本身是超出计算机语言的,无论你用那种方式写程序,只要有满足
monad 的结构,它就在那里,无非是作为一个程序员,你是否意识到了,意识到之后是
否能够利用 monad 的特征来完成想要完成的任务。
Monad 最先用于编程就是在 Haskell 里,这不是一个巧合。只有 Haskell 如此偏执地
追求无副作用操作,才有 Monad,以及更多 category 理论概念存在的土壤。
到底 Monad 有什么用?我举个例子。如果你学习一下 CPS Monad,然后实现一个 co-
routine 到 event loop 的变换,就能够了解由 Node.js 引发的 async 编程潮流,只
是一个浮夸的假象。在 Haskell 里面,根本无需语言本身支持,直接能够写出 co-
routine 程序,以 async 方式执行。
3. Fusion
这个牵涉到编译器的技术,可能不是所有人感兴趣。不过那些认为高级语言,或者是抽
象层高的编程方式,肯定是没有效率的说法,可以休矣。
举个我今天遇到的例子,一个 image convolution 的 Haskell 程序,居然把 memory
bandwidth 耗尽,比 C 程序快了近十倍,然后 4 thread 和 1 thread 执行起来时间
是一样的,完全没有道理,让我同事很伤脑筋。后来经过分析机器码发现,是因为源程
序里用来测试的 image 也是写在程序里通过一个函数生成的,编译器居然把所有的计
算(从 src image 读入数据,计算,写入 dst image)化简为直接向 dst image 写入
constant。
虽然是个极端的例子,但是这种对源程序进行推理,利用代数性质做等效变换,最后能
够生成非常高效代码的方式,只有在纯 FP 语言里才有可能做到。
当然反过来说,认为 FP 的效率已经比 C 好了,也是没有什么道理的。但一个不争的
事实是,符合高层次逻辑的程序更容易写,更容易维护,而另一方面 CPU 的发展导致
只有紧贴机器层面才能够高效发挥硬件潜力。这两者之间的 gap 越来越大,而 FP 的
理论可以把人从 SIMD/Cache Miss/Multi-Core 等等调优的繁琐过程中解放出来,从而
维持原代码的模块和逻辑清晰。
4. DSL
这个是我喜欢 Haskell 的主要原因。没有任何一个语言能够像 Haskell 这样灵活
地实现 DSL/eDSL,对程序做分析,重组,解释甚至和元语言一块儿编译执行。因为
DSL 本身是直接以 combinator 或者 monad 方式写在 Haskell 程序里面的,
无须另外做 lexer/parser,连类型检查都是免费得来。
Haskell 的类型系统在这里帮了很多忙,它的 type class 让很多繁复的 AST
操作变得非常模块化,对副作用的严格控制也让 DSL 更加安全可靠。所以
Simon PJ 说 Haskell is the best imperative programming language
不是没有道理的。

annotated

【在 t*s 的大作中提到】
: 最近在学Haskell
: 看learn yourself a haskell七八章了。到现在为止没看到Python没有的feature.
: Python里面partial, list comprehension, map, reduce, filter都有
: 什么Eq Ord Show这种Python也有,例如, 一个类如果定义了 __lt__ 等等就能比较
: 所谓Monad也是故弄玄虚,我专门去看了Philp Wadler (principle designer of
: Haskell)的Monads for functional programming。Monad两个字就能解释: annotated
: data. 顶多把那三个laws再加上。
: Maybe有点意思,但imperative的Exceptional Handling更方便,更有效率。
: 最不爽的是Haskell readability sucks。
: 唯一Haskell比Python舒服的地方我觉得是函数定义强制

r*******n
发帖数: 3020
74
我觉得尾递归还不如上loop。

【在 p*****2 的大作中提到】
: 一个最基本的尾递归就把python秒了吧
:
: annotated

p*****2
发帖数: 21240
75

一个东西

【在 r*******n 的大作中提到】
: 我觉得尾递归还不如上loop。
f********o
发帖数: 13
76
google trampoline

【在 p*****2 的大作中提到】
:
: 一个东西

n*w
发帖数: 3393
77
这里常有人用“x能做到的y也能做到为自己辩护”。所有图灵完备的语言都可以做到相
同的事情。不同的是语义,表达能力,等方面的差异。

【在 E*****m 的大作中提到】
:
: 沒什麼是 Python (或任何 TM-complete 語言) 一定做不到的,差別
: 就是簡潔易懂否, 你那個 fibs 例子就長了幾倍,不是嗎?
: 還有個 laziness 的例子 python 更難做的, 用 sieve 來求質數
: primesT = sieve [2..] where
: sieve (p:xs) = p : sieve [x | x <- xs, rem x p /= 0]
: 然後求前 100 個質數就是
: take 100 primesT
: 當然, 我不否認不是所有東西都需要 laziness,只是有時 laziness
: 會讓題目比較好解。

g*****g
发帖数: 34805
78
看你怎么定义主流,到今天ruby的流行程度是很有可能的,超越java是没有可能的。

【在 s***o 的大作中提到】
: that's a stackoverflow "new feature" available on April 1 :)
: 不过我的确是去看java 8对scala能造成啥影响的话题的。好虫说一下,scala还有没有
: 成为主流的可能,或者一直这么不温不火下去?

x****o
发帖数: 21566
79
写的真不错

【在 a*****e 的大作中提到】
: 你有这样的感觉没错,Python 的这些概念都来源于 FP,事实上,从 Lisp 引入 GC 开
: 始,非常多的 FP 的特征,已经越来越普遍地进入到其它非 FP 的语言。
: 我想你要问的是,既然这样,为什么要学习 Haskell 或者 FP?
: 我给几个 Haskell 有,但是你在 python 里面学不到的东西吧:
: 1. Strong type system
: duck typing 看似更灵活,但是实际上它只是一个 sum of all types,没办法保证
: type safty。有时候更 general 不是好事情,反而是有限制,尤其是编译器能够通过
: 静态检查就能确保程序遵守了这些限制,更有益处。举个例子,很多语言都有 SQL 的
: 库可用,但有几个能够静态检查,确保所有发出的 SQL 查询都是合法的?再比如,一
: 个程序需要处理平衡二叉树,你能够通过静态检查就确保不会发生不平衡的情况出现吗

t*s
发帖数: 1504
80
干straw man有意思么?
我的意思就是相对于其他语言(例如Python),Haskell卖点不足, 绝大多数程序员没理
由去学Haskell。
fp的卖点有些什么? pure function, curry, laziness, 常见工具list
comprehension, map, reduce, filter。 这些python都支持。
同时,Haskell有致命的缺点,因为有些算法本身就不适合FP。
遇到适合fp的问题, python程序员也可以写fp风格的code。遇到不适合fp的问题,
Haskell程序员就要头大了。
作为一个Haskell没入门的,我只能说到目前为止, Haskell吸引我的是三点
1 编译语言做科学计算快
2 作为数学出身,Haskell看起来美
3 Haskell的type system很好
Haskell community关键是没有一个好tutorial. 至少我没找到。
learn your a haskell是很烂的tutorial
我review这个tutorial的话我会提如下意见
1. 重点介绍独特的feature, 重点讲motivation
2. remove all unnecessary details, or move ot the reference -- 为什么第二章
就讲一大堆list的库函数?
教c语言的会开篇就把strings.h里面的函数一一列举的么?

【在 n*w 的大作中提到】
: 这里常有人用“x能做到的y也能做到为自己辩护”。所有图灵完备的语言都可以做到相
: 同的事情。不同的是语义,表达能力,等方面的差异。

相关主题
批判 goclojure这语言真不错
1st class citizen大牛给讲讲monad吧?
我还是认为scala的程序员水平高functional programming 哪本书经典适合入门
进入Programming版参与讨论
E*****m
发帖数: 25615
81
我認為 Haskell 的最大賣點應該是不讓你做某些事, 強迫你別弄出
不該有的錯誤。
再說一次, Python 的 laziness 不是同個等級的, 完全不能比。
Haskell 的速度也比 Python 快得多。
Real World Haskell 比 Learn yourself a Haskell 更好點。

【在 t*s 的大作中提到】
: 干straw man有意思么?
: 我的意思就是相对于其他语言(例如Python),Haskell卖点不足, 绝大多数程序员没理
: 由去学Haskell。
: fp的卖点有些什么? pure function, curry, laziness, 常见工具list
: comprehension, map, reduce, filter。 这些python都支持。
: 同时,Haskell有致命的缺点,因为有些算法本身就不适合FP。
: 遇到适合fp的问题, python程序员也可以写fp风格的code。遇到不适合fp的问题,
: Haskell程序员就要头大了。
: 作为一个Haskell没入门的,我只能说到目前为止, Haskell吸引我的是三点
: 1 编译语言做科学计算快

p*****2
发帖数: 21240
82

Haskell不行,不代表FP不行呀。上边不是已经说了吗,python吸收了大量FP的feature
。FP的很多feature还是很有用的,不然Python吸收干嘛?当然了,我也认为混合型的
语言更现实,比如python,ruby,scala这些。

【在 t*s 的大作中提到】
: 干straw man有意思么?
: 我的意思就是相对于其他语言(例如Python),Haskell卖点不足, 绝大多数程序员没理
: 由去学Haskell。
: fp的卖点有些什么? pure function, curry, laziness, 常见工具list
: comprehension, map, reduce, filter。 这些python都支持。
: 同时,Haskell有致命的缺点,因为有些算法本身就不适合FP。
: 遇到适合fp的问题, python程序员也可以写fp风格的code。遇到不适合fp的问题,
: Haskell程序员就要头大了。
: 作为一个Haskell没入门的,我只能说到目前为止, Haskell吸引我的是三点
: 1 编译语言做科学计算快

L***n
发帖数: 6727
83
做科学计算的用haskell需要很大勇气...

【在 t*s 的大作中提到】
: 干straw man有意思么?
: 我的意思就是相对于其他语言(例如Python),Haskell卖点不足, 绝大多数程序员没理
: 由去学Haskell。
: fp的卖点有些什么? pure function, curry, laziness, 常见工具list
: comprehension, map, reduce, filter。 这些python都支持。
: 同时,Haskell有致命的缺点,因为有些算法本身就不适合FP。
: 遇到适合fp的问题, python程序员也可以写fp风格的code。遇到不适合fp的问题,
: Haskell程序员就要头大了。
: 作为一个Haskell没入门的,我只能说到目前为止, Haskell吸引我的是三点
: 1 编译语言做科学计算快

E*****m
发帖数: 25615
84

除了做練習以外, 用 Haskell 都需要勇氣。

【在 L***n 的大作中提到】
: 做科学计算的用haskell需要很大勇气...
m*********t
发帖数: 527
85
我怎么听起来觉得你在举反例呢。。。。这个 case 里面编译器干的是多余(可能不安
全)的事情吧。
“编译器居然把所有的计
算(从 src image 读入数据,计算,写入 dst image)化简为直接向 dst image 写入
constant。

最终程序得到想要的结果呢还是不是?你觉得这个是好事?

3. Fusion
这个牵涉到编译器的技术,可能不是所有人感兴趣。不过那些认为高级语言,或者是抽
象层高的编程方式,肯定是没有效率的说法,可以休矣。
举个我今天遇到的例子,一个 image convolution 的 Haskell 程序,居然把 memory
bandwidth 耗尽,比 C 程序快了近十倍,然后 4 thread 和 1 thread 执行起来时间
是一样的,完全没有道理,让我同事很伤脑筋。后来经过分析机器码发现,是因为源程
序里用来测试的 image 也是写在程序里通过一个函数生成的,编译器居然把所有的计
算(从 src image 读入数据,计算,写入 dst image)化简为直接向 dst image 写入
constant。
虽然是个极端的例子,但是这种对源程序进行推理,利用代数性质做等效变换,最后能
够生成非常高效代码的方式,只有在纯 FP 语言里才有可能做到。
当然反过来说,认为 FP 的效率已经比 C 好了,也是没有什么道理的。但一个不争的
事实是,符合高层次逻辑的程序更容易写,更容易维护,而另一方面 CPU 的发展导致
只有紧贴机器层面才能够高效发挥硬件潜力。这两者之间的 gap 越来越大,而 FP 的
理论可以把人从 SIMD/Cache Miss/Multi-Core 等等调优的繁琐过程中解放出来,从而
维持原代码的模块和逻辑清晰。

【在 a*****e 的大作中提到】
: 你有这样的感觉没错,Python 的这些概念都来源于 FP,事实上,从 Lisp 引入 GC 开
: 始,非常多的 FP 的特征,已经越来越普遍地进入到其它非 FP 的语言。
: 我想你要问的是,既然这样,为什么要学习 Haskell 或者 FP?
: 我给几个 Haskell 有,但是你在 python 里面学不到的东西吧:
: 1. Strong type system
: duck typing 看似更灵活,但是实际上它只是一个 sum of all types,没办法保证
: type safty。有时候更 general 不是好事情,反而是有限制,尤其是编译器能够通过
: 静态检查就能确保程序遵守了这些限制,更有益处。举个例子,很多语言都有 SQL 的
: 库可用,但有几个能够静态检查,确保所有发出的 SQL 查询都是合法的?再比如,一
: 个程序需要处理平衡二叉树,你能够通过静态检查就确保不会发生不平衡的情况出现吗

a*****e
发帖数: 1700
86
运行结果完全正确,程序没有任何问题,编译器进行这种程度的优化都是基于数理逻辑
的推断,确保安全。
唯一的问题是运行时间不符合事先的期望,没想到会 saturate memory bandwidth。后
来发现是因为用于测试的 src image 写在了程序里,如果从文件读取,则编译器不会
把这部分也优化掉。

【在 m*********t 的大作中提到】
: 我怎么听起来觉得你在举反例呢。。。。这个 case 里面编译器干的是多余(可能不安
: 全)的事情吧。
: “编译器居然把所有的计
: 算(从 src image 读入数据,计算,写入 dst image)化简为直接向 dst image 写入
: constant。
: ”
: 最终程序得到想要的结果呢还是不是?你觉得这个是好事?
:
: 3. Fusion
: 这个牵涉到编译器的技术,可能不是所有人感兴趣。不过那些认为高级语言,或者是抽

m*********t
发帖数: 527
87
其实你们应该多说说:什么样的问题用 FP 来解决很合适,和 OOP 比较呢?。内核以
及嵌入式? 前端? game?数据分析?复杂的并行和需要大量内存的科学计算? 我看
到一些 haskell 的例子内存占用似乎比 C 要多好几倍(是不是 immutable 的原因?
),这样对于 memory bandwidth limit
的计算程序怎么弄?
还有说说这东西在大规模开发的时候代码可读性和可维护性?

【在 a*****e 的大作中提到】
: 运行结果完全正确,程序没有任何问题,编译器进行这种程度的优化都是基于数理逻辑
: 的推断,确保安全。
: 唯一的问题是运行时间不符合事先的期望,没想到会 saturate memory bandwidth。后
: 来发现是因为用于测试的 src image 写在了程序里,如果从文件读取,则编译器不会
: 把这部分也优化掉。

g*****g
发帖数: 34805
88
Actor model在Erlang上的使用,是我知道的唯一有说服力的例子。Scala火起来同样也
是因为Actor model的实现(Akka)。除此之外,FP基本上都用在语言相关的领域。

【在 m*********t 的大作中提到】
: 其实你们应该多说说:什么样的问题用 FP 来解决很合适,和 OOP 比较呢?。内核以
: 及嵌入式? 前端? game?数据分析?复杂的并行和需要大量内存的科学计算? 我看
: 到一些 haskell 的例子内存占用似乎比 C 要多好几倍(是不是 immutable 的原因?
: ),这样对于 memory bandwidth limit
: 的计算程序怎么弄?
: 还有说说这东西在大规模开发的时候代码可读性和可维护性?

E*****m
发帖数: 25615
89

隨便舉兩個商用例子, ITA 和 Jane Street 都不是處理語言的。

【在 g*****g 的大作中提到】
: Actor model在Erlang上的使用,是我知道的唯一有说服力的例子。Scala火起来同样也
: 是因为Actor model的实现(Akka)。除此之外,FP基本上都用在语言相关的领域。

g*****g
发帖数: 34805
90
They are not exactly industry-leading companies or applications. ITA was
acquired for 700 Million, PCLN is worth 35 Billion. Jane Street has 280
employees. GS has 30K. Just some perspectives to look at.

【在 E*****m 的大作中提到】
:
: 隨便舉兩個商用例子, ITA 和 Jane Street 都不是處理語言的。

相关主题
也谈OOP跟FP之争粉FP的人是因为把电脑想象成图灵机了
OOP里面的Object其实是actor学FP不是为了写代码, 而是为了优秀的架构.
怎么这里这么多人学pythongo几天的一些感受
进入Programming版参与讨论
E*****m
发帖数: 25615
91

You forgot what you claimed?
So, which industry leader use FP for language?
I never said FP is already very successful in industry.

【在 g*****g 的大作中提到】
: They are not exactly industry-leading companies or applications. ITA was
: acquired for 700 Million, PCLN is worth 35 Billion. Jane Street has 280
: employees. GS has 30K. Just some perspectives to look at.

g*****g
发帖数: 34805
92
Erlang's usage in Ericsson is an industry leading example. It's high
availability is hard to achieve with other languages. I stress industry
leading because that's only way to convince adoption.

【在 E*****m 的大作中提到】
:
: You forgot what you claimed?
: So, which industry leader use FP for language?
: I never said FP is already very successful in industry.

E*****m
发帖数: 25615
93
Obviously, it's not the only way. Otherwise, how did Java come along?

【在 g*****g 的大作中提到】
: Erlang's usage in Ericsson is an industry leading example. It's high
: availability is hard to achieve with other languages. I stress industry
: leading because that's only way to convince adoption.

g*****g
发帖数: 34805
94
So you don't know nothing about history. Java came along as the industry
leading enterprise application language on server side. C++ was the primary
contest at the time, but it's quickly overcame by Java's reliability and
fast time-to-market.

【在 E*****m 的大作中提到】
: Obviously, it's not the only way. Otherwise, how did Java come along?
E*****m
发帖数: 25615
95

primary
I started programming Java sometime in '96 or so. I know it quite well.
And you forgot your claim again. What convinced the first industry leader
to use Java?

【在 g*****g 的大作中提到】
: So you don't know nothing about history. Java came along as the industry
: leading enterprise application language on server side. C++ was the primary
: contest at the time, but it's quickly overcame by Java's reliability and
: fast time-to-market.

g*****g
发帖数: 34805
96
Everything starts as an experiment. But it didn't take long before Java
dominated in the enterprise market. Java was released in 1995. J2EE 1.2 spec
was out in 1999 and I used that for websites in 2000. Your hello world
experience in school doesn't count.
In comparison, which FP today is a Spring chicken?

【在 E*****m 的大作中提到】
:
: primary
: I started programming Java sometime in '96 or so. I know it quite well.
: And you forgot your claim again. What convinced the first industry leader
: to use Java?

E*****m
发帖数: 25615
97

spec
Thank you for your wrong speculation. I wrote my thesis work in Java, which
is a little bit more than hello world.
So, what convinced the first industry leader to use Java?
I'd say Scala is promising. But I am not a coder, I don't need to bet on it.

【在 g*****g 的大作中提到】
: Everything starts as an experiment. But it didn't take long before Java
: dominated in the enterprise market. Java was released in 1995. J2EE 1.2 spec
: was out in 1999 and I used that for websites in 2000. Your hello world
: experience in school doesn't count.
: In comparison, which FP today is a Spring chicken?

g*****g
发帖数: 34805
98
Your thesis, LOL. Wonder what's the usage of your thesis in industry? Sorry,
does it hurt to talk about reality?
Sun invented Java. Obviously they had interests in Java, much like M$ on .
Net. Sun happened to be an industry leader in enterprise space at that time.
In fact, IBM joined the force in no time and M$ wanted to adopt it too with
their own variation. The rest is history.

which
it.

【在 E*****m 的大作中提到】
:
: spec
: Thank you for your wrong speculation. I wrote my thesis work in Java, which
: is a little bit more than hello world.
: So, what convinced the first industry leader to use Java?
: I'd say Scala is promising. But I am not a coder, I don't need to bet on it.

g*****g
发帖数: 34805
99
I worked on Scala for 2 years, long before you exist here. And I am talking
about industry projects.
Scala got hot due to Akka, which is a good and bad thing. On one hand, it's
promising like how Erlang was proven in telecom industry. On the other hand,
the majority of applications don't need Akka, which makes Scala less
attractive as a general purpose language.

which
it.

【在 E*****m 的大作中提到】
:
: spec
: Thank you for your wrong speculation. I wrote my thesis work in Java, which
: is a little bit more than hello world.
: So, what convinced the first industry leader to use Java?
: I'd say Scala is promising. But I am not a coder, I don't need to bet on it.

E*****m
发帖数: 25615
100

Sorry,
It's funny that you can never remember what we are discussing.
time.
with
So, you are saying it's possible to use a new language when there are no
other
industry leader using it. Right?

【在 g*****g 的大作中提到】
: Your thesis, LOL. Wonder what's the usage of your thesis in industry? Sorry,
: does it hurt to talk about reality?
: Sun invented Java. Obviously they had interests in Java, much like M$ on .
: Net. Sun happened to be an industry leader in enterprise space at that time.
: In fact, IBM joined the force in no time and M$ wanted to adopt it too with
: their own variation. The rest is history.
:
: which
: it.

相关主题
Haskell很难学。。对 (im)mutability 的误解和深度理解
FP更接近人的思维王垠新文 为Java说句公道话
有没有喜欢haskell的同学我对为什么使用FP的理解 (补)
进入Programming版参与讨论
g*****g
发帖数: 34805
101
You can always use a new or old language in a new or old area. And there's
always a chance of success. It's only that I wouldn't claim their
superiority before their success. Let the reality do the talk, that's my
stance.

【在 E*****m 的大作中提到】
:
: Sorry,
: It's funny that you can never remember what we are discussing.
: time.
: with
: So, you are saying it's possible to use a new language when there are no
: other
: industry leader using it. Right?

a*****e
发帖数: 1700
102
如果你要问我,我会说几乎没有什么是 FP 不适合的,就连内核以及嵌入式,FPGA 等
都有 FP 的解决方案。
这里我并不是说内核或者嵌入设备去跑 FP 语言的 runtime,而是说用 FP 的工具设计
的 DSL 跑在内核和嵌入设备上。比如你可以搜一下 se4L,它的一个实现是用 Haskell
写的,被用于证明所生成的内核的正确性。
I'm a big believer in DSL. 合理设计的 DSL 能够快速完成目标 domain 的编程要求
,所需要的只是一个有效的 DSL 开发环境,FP 在这方面非常适合。就象是一套合理设
计的库函数或者框架什么的,能够大幅度提高开发效率。但是库函数的组合调用通常都
是写在源程序里,写好就不可以改动。而 DSL 则是它本身可以被分析重组,写好之后
,还可以用程序处理变换,验证性质,生成高效代码等。元语言 (meta programming)
的技术目前也在抬头,但我认为还是 DSL 更灵活,因为 meta programming 所操作的
对象还是一个 general purpose 的语言所写的程序结构,很多时候我们只需要 domain
specific.
你说内存用得多,应该是 Copying GC 带来的,Java 这方面也是一样的,消耗内存总
是会比 C 多。Haskell 还有一个问题是 memory leak,这是 lazy language 的一个硬
伤。正确的程序不会有这种问题,虽然如何书写正确的 memory leak free 的 Haskell
程序有时候是一个 black art。
关于 immutable 的问题,如果你对现代的编译技术有了解,比如 SSA 什么的,就会发
现在编译局部变量时,其实 C 里面那些看起来是 mutable 的变量,都已经被转化成只
能赋值一次的虚拟寄存器了,所以是否 mutable 只影响需要共享数据的全局变量。
这方面,采取 immutable 的数据结构也会更适合 modern CPU,比如 cache-friendly
(sharing, no read/write barrier),比如 SIMD ,比如 thread 间数据的交换,可
以尽量避免 CAS 等。就连 Garbage Collection 也可以针对 cache 进行优化,而不需
要修改应用层面的东西。Scientific Computing 很多时候追求高效,结果把 C 或者
Fortran 的源程序调得乱糟糟,事后很难维护,长远来看是得不偿失的。
immutable 不占优势的一个情况,就是迅速产生大量垃圾,给 GC 造成负担过大。但这
毕竟很少见,通过 profiling 等技术也可以迅速发现问题所在,从应用层面可以调整
,比如适度允许 mutable 的结构,避免反复的 allocation。
还有一个弱点,主要是从算法层面,比如 graph 和 hashtable 的结构用 immutable
不能做,或者比较没效率。
所以 FP 也不是说拒绝 mutable,而是说如果以 immutable 为主,好处多多。

【在 m*********t 的大作中提到】
: 其实你们应该多说说:什么样的问题用 FP 来解决很合适,和 OOP 比较呢?。内核以
: 及嵌入式? 前端? game?数据分析?复杂的并行和需要大量内存的科学计算? 我看
: 到一些 haskell 的例子内存占用似乎比 C 要多好几倍(是不是 immutable 的原因?
: ),这样对于 memory bandwidth limit
: 的计算程序怎么弄?
: 还有说说这东西在大规模开发的时候代码可读性和可维护性?

d****i
发帖数: 4809
103
你说的FPGA都有FP的解决方案我倒是闻所未闻,FPGA一般用Verilog或者VHDL, 或者
SystemC,都是工业界的标准。

等都有 FP 的解决方案。

【在 a*****e 的大作中提到】
: 如果你要问我,我会说几乎没有什么是 FP 不适合的,就连内核以及嵌入式,FPGA 等
: 都有 FP 的解决方案。
: 这里我并不是说内核或者嵌入设备去跑 FP 语言的 runtime,而是说用 FP 的工具设计
: 的 DSL 跑在内核和嵌入设备上。比如你可以搜一下 se4L,它的一个实现是用 Haskell
: 写的,被用于证明所生成的内核的正确性。
: I'm a big believer in DSL. 合理设计的 DSL 能够快速完成目标 domain 的编程要求
: ,所需要的只是一个有效的 DSL 开发环境,FP 在这方面非常适合。就象是一套合理设
: 计的库函数或者框架什么的,能够大幅度提高开发效率。但是库函数的组合调用通常都
: 是写在源程序里,写好就不可以改动。而 DSL 则是它本身可以被分析重组,写好之后
: ,还可以用程序处理变换,验证性质,生成高效代码等。元语言 (meta programming)

a*****e
发帖数: 1700
104
不算是业界主流,多数还是 research 性质,顺手搜一下
http://raintown.org/lava/
http://cufp.org/conference/sessions/2012/peter-braam-parallel-s
ICFP/POPL 这类的 conference 上经常有这类的,也算热点之一吧

【在 d****i 的大作中提到】
: 你说的FPGA都有FP的解决方案我倒是闻所未闻,FPGA一般用Verilog或者VHDL, 或者
: SystemC,都是工业界的标准。
:
: 等都有 FP 的解决方案。

L***n
发帖数: 6727
105
比如?你所说的问题,即使存在,解决办法也应该是由专家维护高质量的库,而不是
使用DSL,在学术界,使用DSL的问题包括没有统一标准,混用DSL和已有语言C/C++
的代价,代码效率,等等,都是无法接受的。我本人倒是用过不少设计的不那么优美的
库,也试过一些DSL, 我宁愿用界面乱糟糟一些的C/C++/Fortran库,也不愿在我的代码
里用我自己都不知道怎么debug的DSL
t*****n
发帖数: 4908
106
这方面,采取 immutable 的数据结构也会更适合 modern CPU,比如 cache-friendly
(sharing, no read/write barrier),比如 SIMD ,比如 thread 间数据的交换,可
以尽量避免 CAS 等。就连 Garbage Collection 也可以针对 cache 进行优化,而不需
要修改应用层面的东西。Scientific Computing 很多时候追求高效,结果把 C 或者
Fortran 的源程序调得乱糟糟,事后很难维护,长远来看是得不偿失的。
真能码字。不过计算远没有你想的那么差。只有低水平的编程者,没有生来就乱的语言
。高手写的fortran,远胜入门者写的fp。

Haskell
)

【在 a*****e 的大作中提到】
: 如果你要问我,我会说几乎没有什么是 FP 不适合的,就连内核以及嵌入式,FPGA 等
: 都有 FP 的解决方案。
: 这里我并不是说内核或者嵌入设备去跑 FP 语言的 runtime,而是说用 FP 的工具设计
: 的 DSL 跑在内核和嵌入设备上。比如你可以搜一下 se4L,它的一个实现是用 Haskell
: 写的,被用于证明所生成的内核的正确性。
: I'm a big believer in DSL. 合理设计的 DSL 能够快速完成目标 domain 的编程要求
: ,所需要的只是一个有效的 DSL 开发环境,FP 在这方面非常适合。就象是一套合理设
: 计的库函数或者框架什么的,能够大幅度提高开发效率。但是库函数的组合调用通常都
: 是写在源程序里,写好就不可以改动。而 DSL 则是它本身可以被分析重组,写好之后
: ,还可以用程序处理变换,验证性质,生成高效代码等。元语言 (meta programming)

G***l
发帖数: 355
107
我最近也在做DSL,请问有什么好的讲FP实现DSL的书吗?以前用OO的语言做过,实现起
来比较麻烦。用了antlr做parser generator会好一些,但是还是挺麻烦的。

Haskell
)

【在 a*****e 的大作中提到】
: 如果你要问我,我会说几乎没有什么是 FP 不适合的,就连内核以及嵌入式,FPGA 等
: 都有 FP 的解决方案。
: 这里我并不是说内核或者嵌入设备去跑 FP 语言的 runtime,而是说用 FP 的工具设计
: 的 DSL 跑在内核和嵌入设备上。比如你可以搜一下 se4L,它的一个实现是用 Haskell
: 写的,被用于证明所生成的内核的正确性。
: I'm a big believer in DSL. 合理设计的 DSL 能够快速完成目标 domain 的编程要求
: ,所需要的只是一个有效的 DSL 开发环境,FP 在这方面非常适合。就象是一套合理设
: 计的库函数或者框架什么的,能够大幅度提高开发效率。但是库函数的组合调用通常都
: 是写在源程序里,写好就不可以改动。而 DSL 则是它本身可以被分析重组,写好之后
: ,还可以用程序处理变换,验证性质,生成高效代码等。元语言 (meta programming)

a*****e
发帖数: 1700
108
你说的也对,要是有方便用的,有稳定技术支持,已经被业界普遍采纳的产品就好了。
目前勉强能满足的也就是你说的这些设计上有缺陷的 C/C++/Fortran 库了。
但是 status quo 并非一成不变,没有理由不期待它朝更好的方向发展。
我谈的也都是一些 FP 的发展方向和(个人浅见)优势所在,并非都有成熟的产品。

【在 L***n 的大作中提到】
: 比如?你所说的问题,即使存在,解决办法也应该是由专家维护高质量的库,而不是
: 使用DSL,在学术界,使用DSL的问题包括没有统一标准,混用DSL和已有语言C/C++
: 的代价,代码效率,等等,都是无法接受的。我本人倒是用过不少设计的不那么优美的
: 库,也试过一些DSL, 我宁愿用界面乱糟糟一些的C/C++/Fortran库,也不愿在我的代码
: 里用我自己都不知道怎么debug的DSL

a*****e
发帖数: 1700
109
当然也不好一棒子全部打倒,我也就是最近接触这方面,有感而发。
为了追求效率全部改用 SIMD intrinsic 写东西,还真不是人干的事儿。

【在 t*****n 的大作中提到】
: 这方面,采取 immutable 的数据结构也会更适合 modern CPU,比如 cache-friendly
: (sharing, no read/write barrier),比如 SIMD ,比如 thread 间数据的交换,可
: 以尽量避免 CAS 等。就连 Garbage Collection 也可以针对 cache 进行优化,而不需
: 要修改应用层面的东西。Scientific Computing 很多时候追求高效,结果把 C 或者
: Fortran 的源程序调得乱糟糟,事后很难维护,长远来看是得不偿失的。
: 真能码字。不过计算远没有你想的那么差。只有低水平的编程者,没有生来就乱的语言
: 。高手写的fortran,远胜入门者写的fp。
:
: Haskell
: )

E*****m
发帖数: 25615
110

Sounds right to me.
But then why you have to bash those languages you don't know much?

【在 g*****g 的大作中提到】
: You can always use a new or old language in a new or old area. And there's
: always a chance of success. It's only that I wouldn't claim their
: superiority before their success. Let the reality do the talk, that's my
: stance.

相关主题
我对为什么使用FP的理解 (补)1st class citizen
模板算是纯FP吗我还是认为scala的程序员水平高
批判 goclojure这语言真不错
进入Programming版参与讨论
g*****g
发帖数: 34805
111
Since when saying these languages are unproven is a bash?
In case you don't understand, all languages are unproven until proven
otherwise. FP or not.

【在 E*****m 的大作中提到】
:
: Sounds right to me.
: But then why you have to bash those languages you don't know much?

a*****e
发帖数: 1700
112
书这方面我也不是特别了解,都是从 conference paper 和项目代码看过来的。你可以
搜索 IFIP DSL Conference,有 proceeding 什么的。
如果你用 Haskell,基础的理论就是 Monad, Applicative Functor, Arrow 这些。更
基础的是解释器的实现,Oleg 的网站上有些 paper: http://okmij.org/ftp/tagless-final/
而且要看你想做什么,Haskell 这边 parser 类的 DSL 已经很成熟了,hackage 上很
多。电子设计和 control 方面的 DSL 也比较多,上面提到的 Lava, 还有 Atom 都是。

【在 G***l 的大作中提到】
: 我最近也在做DSL,请问有什么好的讲FP实现DSL的书吗?以前用OO的语言做过,实现起
: 来比较麻烦。用了antlr做parser generator会好一些,但是还是挺麻烦的。
:
: Haskell
: )

E*****m
发帖数: 25615
113

You know you said more than "unproven".

【在 g*****g 的大作中提到】
: Since when saying these languages are unproven is a bash?
: In case you don't understand, all languages are unproven until proven
: otherwise. FP or not.

g*****g
发帖数: 34805
114
Right, and I am just being honest. If that hurts your feeling, you are too
sensitive.

【在 E*****m 的大作中提到】
:
: You know you said more than "unproven".

m*********t
发帖数: 527
115
为啥非要强调 “勉强能满足” 以及 “设计有缺陷呢” :p

【在 a*****e 的大作中提到】
: 你说的也对,要是有方便用的,有稳定技术支持,已经被业界普遍采纳的产品就好了。
: 目前勉强能满足的也就是你说的这些设计上有缺陷的 C/C++/Fortran 库了。
: 但是 status quo 并非一成不变,没有理由不期待它朝更好的方向发展。
: 我谈的也都是一些 FP 的发展方向和(个人浅见)优势所在,并非都有成熟的产品。

E*****m
发帖数: 25615
116

If you actually know those languages you bashed, it's a good thing.

【在 g*****g 的大作中提到】
: Right, and I am just being honest. If that hurts your feeling, you are too
: sensitive.

a*****e
发帖数: 1700
117
因为用起来不方便啊。脚本语言比如 python, R 之类的都能够进军这个领域不是正因
为 C/C++/Fortran 的库用起来不方便吗

【在 m*********t 的大作中提到】
: 为啥非要强调 “勉强能满足” 以及 “设计有缺陷呢” :p
G***l
发帖数: 355
118
简答来说就是做一个parser生成AST,跟相应的interpreter。比如一个basic语法的dsl
,当然我的肯定不会有一个正式的语言那么复杂。

是。

【在 a*****e 的大作中提到】
: 书这方面我也不是特别了解,都是从 conference paper 和项目代码看过来的。你可以
: 搜索 IFIP DSL Conference,有 proceeding 什么的。
: 如果你用 Haskell,基础的理论就是 Monad, Applicative Functor, Arrow 这些。更
: 基础的是解释器的实现,Oleg 的网站上有些 paper: http://okmij.org/ftp/tagless-final/
: 而且要看你想做什么,Haskell 这边 parser 类的 DSL 已经很成熟了,hackage 上很
: 多。电子设计和 control 方面的 DSL 也比较多,上面提到的 Lava, 还有 Atom 都是。

a*****e
发帖数: 1700
119
BASIC 已经有了,Lennart Augustsson 写的在这儿:
http://hackage.haskell.org/package/BASIC-0.1.5.0
http://augustss.blogspot.com/search/label/BASIC
这个实现很有趣,连 syntax 都和 BASIC 非常接近,虽然是 embeded DSL,也就是说
直接跳过了 parser 这部分
G***l
发帖数: 355
120
我想了解的就是如何用pattern matching之类的高级特性,高效的写出一个dsl。可惜
目前好像还没有这方面的书。

【在 a*****e 的大作中提到】
: BASIC 已经有了,Lennart Augustsson 写的在这儿:
: http://hackage.haskell.org/package/BASIC-0.1.5.0
: http://augustss.blogspot.com/search/label/BASIC
: 这个实现很有趣,连 syntax 都和 BASIC 非常接近,虽然是 embeded DSL,也就是说
: 直接跳过了 parser 这部分

相关主题
大牛给讲讲monad吧?OOP里面的Object其实是actor
functional programming 哪本书经典适合入门怎么这里这么多人学python
也谈OOP跟FP之争粉FP的人是因为把电脑想象成图灵机了
进入Programming版参与讨论
a*****e
发帖数: 1700
121
如果你说的高效是指快速实现一个DSL的解释器,那么上面我给的那个blog链接是个很
好的例子。
首先,它绕过了 parser,因为程序本身虽然看起来象 BASIC,但实际上都是 Haskell
,直接代表 AST,所以省去很多前期的麻烦。这就叫做 embeded DSL。只需要定义
合适的 AST,然后对之进行 pattern match 解释执行就好了。
其次,embedded DSL 可以直接使用 host language 里面的值和函数,比如数字表达式
什么的,直接用,无须单独处理。你要做的工作可以完全放在你所定义的 DSL 的核心语
义上面。
最后,如果你追求 DSL 本身运行起来的效率,那么可以采取 finally taggless 的方
式,定义 combinator 来组建 DSL,它们本身就是 host language 里的函数,由
host language 的编译器直接编译,无须另写 AST 和解释器。我上面给的 Oleg 的链
接里有这个 paper。
所以从 embedded DSL 入手,实现一个新的 DSL 过程被大大简化,应该是相当有效率
的。
如果你不是打算用 Haskell,其它语言也可以,比如 scheme 这样的,macro 处理也相
当强大。

【在 G***l 的大作中提到】
: 我想了解的就是如何用pattern matching之类的高级特性,高效的写出一个dsl。可惜
: 目前好像还没有这方面的书。

G***l
发帖数: 355
122
这个是很好,但是好像也偶缺陷。比如我以前用Java写,用户输入是各种文本,然后在
后台程序里,我在Java里面把这些文本parse成AST并且interpret,最后得到他们的结
果,比如:
用户写的dsl是MonthDiff(Date1, Date2) + 1 > SomeValue
我读入这个文本到monthControl, 并且在inputData里放入Date1, Date2, SomeValue的
值(从数据库或者什么地方读过来的)。然后写,
//evaluate里做parsing和interpret
result = evaluate(monthControl, inputData)
if(result)
{
//do business logic
}
这样用户就可以写dsl直接控制我程序里的logic。假如改用haskell用embedded的话,
我的haskell程序没法直接调用那个dsl,除非把那个dsl写到我的source code,然后动
态编译运行,但是我不想要那样。或者可以有什么类似swig之类的东西让我动态调用
haskell code,但是我没法把inputData传过去。
。用这种embedded dsl的方式好像就不能那样做了。

Haskell
心语

【在 a*****e 的大作中提到】
: 如果你说的高效是指快速实现一个DSL的解释器,那么上面我给的那个blog链接是个很
: 好的例子。
: 首先,它绕过了 parser,因为程序本身虽然看起来象 BASIC,但实际上都是 Haskell
: ,直接代表 AST,所以省去很多前期的麻烦。这就叫做 embeded DSL。只需要定义
: 合适的 AST,然后对之进行 pattern match 解释执行就好了。
: 其次,embedded DSL 可以直接使用 host language 里面的值和函数,比如数字表达式
: 什么的,直接用,无须单独处理。你要做的工作可以完全放在你所定义的 DSL 的核心语
: 义上面。
: 最后,如果你追求 DSL 本身运行起来的效率,那么可以采取 finally taggless 的方
: 式,定义 combinator 来组建 DSL,它们本身就是 host language 里的函数,由

g*****g
发帖数: 34805
123
I don't need to know those languages to know how much they are being used in
the industry. Simple as that.

【在 E*****m 的大作中提到】
:
: If you actually know those languages you bashed, it's a good thing.

a*****e
发帖数: 1700
124
你说的这个是经典的解释器,用户并不直接接触到实际的编译器,而是通过网站或什么
别的途径输入写好的脚本,你在后台来执行它。我这样理解没错吧?
你可以分两步走,第一步,先把 DSL AST 所需要的 data type 定义出来,然后对此写
一个解释器。调试过程中,可以直接用 datatype 写 AST,省去写 parser 的麻烦。
第一步做好了,然后就可以用 haskell parsec 之类的库把程序输入的字串转换为 AST
,略为学习一下 parsec 的用法就好了,简单的 recursive descent。
做 embeded DSL 可以省去第二步,但的确,在你的情况中,还是需要一个 parser 的
部分。

【在 G***l 的大作中提到】
: 这个是很好,但是好像也偶缺陷。比如我以前用Java写,用户输入是各种文本,然后在
: 后台程序里,我在Java里面把这些文本parse成AST并且interpret,最后得到他们的结
: 果,比如:
: 用户写的dsl是MonthDiff(Date1, Date2) + 1 > SomeValue
: 我读入这个文本到monthControl, 并且在inputData里放入Date1, Date2, SomeValue的
: 值(从数据库或者什么地方读过来的)。然后写,
: //evaluate里做parsing和interpret
: result = evaluate(monthControl, inputData)
: if(result)
: {

d*******i
发帖数: 77
125
我看到 functional programming 好处。
* immutable. 这点在并行运算中力量很大. 试想如果保证所有的arguments 都没有
state change那传统一以上的locking, synchronization就不存在了或没必要了。 大
大提高了程序可读性和可维护性。
* First class/Hight order functions. function 可以作为argument。 好处是大大
提高function 的易重用行和简便性。
* Syntax 简单。 上边讲过AST, Java 有很多事先制定 好的keyword match 到AST。
不过clojure 自己就是一个AST, 程序员可以自己定制macros, 所以程序syntax 很简
单又很flexible. 学一种语言不用象Java 那样去记它特定的语法。
由于强调 immutable , no state. FP 在现实production中多用于后台数据处理。 现
在在Big data 里很吃香。 但是有些时候是不可能完全no state, 比如你的程序调用
3rd party web service, 你就得持有一个state 去调用它, 在这个层级上
imperative
programming 就比较好一些。
E*****m
发帖数: 25615
126

in
So, after 10 years, you regress from a visionary who can predict Java's
success to
a trend follower.

【在 g*****g 的大作中提到】
: I don't need to know those languages to know how much they are being used in
: the industry. Simple as that.

m*********t
发帖数: 527
127
What about memory bandwith limit if you use all pure immutable objects? e.g.
I have a parallel gpu program that read + write 200 GB/s on the GDDR5 RAM.

【在 d*******i 的大作中提到】
: 我看到 functional programming 好处。
: * immutable. 这点在并行运算中力量很大. 试想如果保证所有的arguments 都没有
: state change那传统一以上的locking, synchronization就不存在了或没必要了。 大
: 大提高了程序可读性和可维护性。
: * First class/Hight order functions. function 可以作为argument。 好处是大大
: 提高function 的易重用行和简便性。
: * Syntax 简单。 上边讲过AST, Java 有很多事先制定 好的keyword match 到AST。
: 不过clojure 自己就是一个AST, 程序员可以自己定制macros, 所以程序syntax 很简
: 单又很flexible. 学一种语言不用象Java 那样去记它特定的语法。
: 由于强调 immutable , no state. FP 在现实production中多用于后台数据处理。 现

g*****g
发帖数: 34805
128
I am not being stubborn. I am being consistent. I saw Java succeeded 10
years ago the same reasons I don't see FP languages succeed today.
I have mentioned these reasons in many posts, for a language to be adopted
by massive as a general purpose language, it should be/have
1. Easy to learn, easy to use, easy to maintain
2. Big or quickly growing community
3. Killer framework or application
4. Adequate libraries
5. Company backing
Now Scala is the only FP language I know that has 2/3/4/5, that's one of the
reasons why I picked it up and used it for 2 years. Then I realize 1 is a
very big hurdle in a team setup with a big project, which can still be
overcame in a top notch company with top talents but the growth is hindered
nonetheless.
Other FP languages don't even come close. And none of them ever achieve 1.
Now maybe in the future there'll be new languages change all these. But I
can say for sure all well-known FP languages don't. For that reason they'll
remain niche languages. The best they can be is like javascript/Objective C
that excels in a specialized domain.

【在 E*****m 的大作中提到】
:
: in
: So, after 10 years, you regress from a visionary who can predict Java's
: success to
: a trend follower.

d**********x
发帖数: 4083
129
人总是在遇到问题的时候才想起来前人总结的经验。。。
编译原理一上来就说了语言的第一大concern就是learning cost...

the

【在 g*****g 的大作中提到】
: I am not being stubborn. I am being consistent. I saw Java succeeded 10
: years ago the same reasons I don't see FP languages succeed today.
: I have mentioned these reasons in many posts, for a language to be adopted
: by massive as a general purpose language, it should be/have
: 1. Easy to learn, easy to use, easy to maintain
: 2. Big or quickly growing community
: 3. Killer framework or application
: 4. Adequate libraries
: 5. Company backing
: Now Scala is the only FP language I know that has 2/3/4/5, that's one of the

E*****m
发帖数: 25615
130
I think you really need to put a quantifier "For enterprise software"
for almost everything you said.
In your 5 criteria, only (1) is forward looking. Others are just saying
"I follow the crowd", which is not really a bad thing, for a trend follower.
I guess people who create killer frameworks and libraries might
think differently.

the

【在 g*****g 的大作中提到】
: I am not being stubborn. I am being consistent. I saw Java succeeded 10
: years ago the same reasons I don't see FP languages succeed today.
: I have mentioned these reasons in many posts, for a language to be adopted
: by massive as a general purpose language, it should be/have
: 1. Easy to learn, easy to use, easy to maintain
: 2. Big or quickly growing community
: 3. Killer framework or application
: 4. Adequate libraries
: 5. Company backing
: Now Scala is the only FP language I know that has 2/3/4/5, that's one of the

相关主题
学FP不是为了写代码, 而是为了优秀的架构.FP更接近人的思维
go几天的一些感受有没有喜欢haskell的同学
Haskell很难学。。对 (im)mutability 的误解和深度理解
进入Programming版参与讨论
g*****g
发帖数: 34805
131
Obviously I put a quantifier there, general purpose programming. e.g. Java
is much more than enterprise software, it's very successful on Android
platform as a UI language for personal software, gaming etc. It's not as
successful on PC/Mac but there are famous software like Eclipse and TurboTax
on Mac.
And no, I am not following the crowd. You can see all my criteria fit around
02, 03 already for Java, when I started promoting Java on this board. Yet I
am an early adopter, and not many people listened to me at that time.

follower.

【在 E*****m 的大作中提到】
: I think you really need to put a quantifier "For enterprise software"
: for almost everything you said.
: In your 5 criteria, only (1) is forward looking. Others are just saying
: "I follow the crowd", which is not really a bad thing, for a trend follower.
: I guess people who create killer frameworks and libraries might
: think differently.
:
: the

E*****m
发帖数: 25615
132

TurboTax
around
I
I've the same question as the other guy. How can promoting java in 02 03 be
called "early"? When you are later than IBM, don't you think you're really
really late?

【在 g*****g 的大作中提到】
: Obviously I put a quantifier there, general purpose programming. e.g. Java
: is much more than enterprise software, it's very successful on Android
: platform as a UI language for personal software, gaming etc. It's not as
: successful on PC/Mac but there are famous software like Eclipse and TurboTax
: on Mac.
: And no, I am not following the crowd. You can see all my criteria fit around
: 02, 03 already for Java, when I started promoting Java on this board. Yet I
: am an early adopter, and not many people listened to me at that time.
:
: follower.

d*******i
发帖数: 77
133
Not quite understanding what you mean. Answer your question in assumption.
immutable objects does not mean that can not be garbage collected. I would
rather call it as immutable arguments rather than objects. As long as you do
not have reference with that argument, it can be garbage collected. On the
other hand, it saves memory, since you can only keep one copy of that object
and being reused by all the threads/cores, same concept as singleton.
Talking about performance. People do criticize the the way of "change"
immutable value, since you have to create another value by using the deep
copies. But clojure using some techniques called "Sharing Tech" to avoid
deep copy which is fast

g.

【在 m*********t 的大作中提到】
: What about memory bandwith limit if you use all pure immutable objects? e.g.
: I have a parallel gpu program that read + write 200 GB/s on the GDDR5 RAM.

g*****g
发帖数: 34805
134
Just ask how many people on this BBS have 10+ years of Java experience.
And you know why I am an early adopter.
BTW, academic experience doesn't count. I can see you don't have much
industry experience that's why you make a fuss on everything.

be
really

【在 E*****m 的大作中提到】
:
: TurboTax
: around
: I
: I've the same question as the other guy. How can promoting java in 02 03 be
: called "early"? When you are later than IBM, don't you think you're really
: really late?

r*g
发帖数: 3159
135
这个,在一个版面混了十年的本来就不多。。。

【在 g*****g 的大作中提到】
: Just ask how many people on this BBS have 10+ years of Java experience.
: And you know why I am an early adopter.
: BTW, academic experience doesn't count. I can see you don't have much
: industry experience that's why you make a fuss on everything.
:
: be
: really

g*****g
发帖数: 34805
136
好吧,如果你招人,你就会知道想招一个有10年java经验的人有多么难。

【在 r*g 的大作中提到】
: 这个,在一个版面混了十年的本来就不多。。。
d*******i
发帖数: 77
137
As a programmer, being consistent is being stubborn :) The learning cost to
use a new tool for a 0 experience worker compared with experience worker
using the same tool consistently for 100 years is way much lower.
Talking about big team and big enterprise, you are putting yourself as
mostly an application maintainer or consumer of "Adequate libraries" rather
than programmers or developers.
Anyway, it is the same topic of between doing job and enjoying your career.
The topic is talking about why functional programming is good and why is bad
rather than whether it will be successful in fuc*ng big enterprise. By the
way, killer framework was never wrote by a big team.

the

【在 g*****g 的大作中提到】
: I am not being stubborn. I am being consistent. I saw Java succeeded 10
: years ago the same reasons I don't see FP languages succeed today.
: I have mentioned these reasons in many posts, for a language to be adopted
: by massive as a general purpose language, it should be/have
: 1. Easy to learn, easy to use, easy to maintain
: 2. Big or quickly growing community
: 3. Killer framework or application
: 4. Adequate libraries
: 5. Company backing
: Now Scala is the only FP language I know that has 2/3/4/5, that's one of the

r*g
发帖数: 3159
138
我觉得真神说的一点有道理。这里是programming版,不是programmer版。你自然是资
深高手,但你看这么多问excel/matlab/c input问题的,我觉得超过一半来这里的,不
是职业程序员。那么你的职业建议就难免被一部分人当成废话。

【在 g*****g 的大作中提到】
: 好吧,如果你招人,你就会知道想招一个有10年java经验的人有多么难。
g*****g
发帖数: 34805
139
Talk is cheap. If you are talking about niche language in niche domain, set
the context straight. The reality is that none of these FP languages have
seen massive adoption in the industry. In fact, none of them cracked top 10
in this famous index.
http://www.tiobe.com/index.php/content/paperinfo/tpci/index.htm
Killer framework can be done by small team, killer app rarely is nowadays,
and when it is, it's usually due to brilliant idea, not the language. I
mentioned big team and big project due to practical reason for massive
adoption. It has nothing to do with my job.

to
rather
.
bad
the

【在 d*******i 的大作中提到】
: As a programmer, being consistent is being stubborn :) The learning cost to
: use a new tool for a 0 experience worker compared with experience worker
: using the same tool consistently for 100 years is way much lower.
: Talking about big team and big enterprise, you are putting yourself as
: mostly an application maintainer or consumer of "Adequate libraries" rather
: than programmers or developers.
: Anyway, it is the same topic of between doing job and enjoying your career.
: The topic is talking about why functional programming is good and why is bad
: rather than whether it will be successful in fuc*ng big enterprise. By the
: way, killer framework was never wrote by a big team.

d*******i
发帖数: 77
140
* Not having preference of functional programming vs object oriented
functional programming
* Not Talking which language is better than the other. They have different
ways/benefits/tradeoff to resolve the issues.
* Just want the topic of functional programming to be technical oriented.
* Industrial wide popularity does not mean any success of the language.
Actually it is a sadness of the language. I like Java, but when I worked
with a global fortune 100 client who has 3000 offshore cheap "developers"
fuc*Ng up Java everyday, I do not like my daily job any more. But that is
how enterprise makes the popular language and their standards.
:)

set
10

【在 g*****g 的大作中提到】
: Talk is cheap. If you are talking about niche language in niche domain, set
: the context straight. The reality is that none of these FP languages have
: seen massive adoption in the industry. In fact, none of them cracked top 10
: in this famous index.
: http://www.tiobe.com/index.php/content/paperinfo/tpci/index.htm
: Killer framework can be done by small team, killer app rarely is nowadays,
: and when it is, it's usually due to brilliant idea, not the language. I
: mentioned big team and big project due to practical reason for massive
: adoption. It has nothing to do with my job.
:

相关主题
对 (im)mutability 的误解和深度理解模板算是纯FP吗
王垠新文 为Java说句公道话批判 go
我对为什么使用FP的理解 (补)1st class citizen
进入Programming版参与讨论
g*****g
发帖数: 34805
141
I am not against anyone using FP in a niche domain. I am merely talking why
existing FPs won't see massive adoption as a general purpose language.
I tend to quantify the success of the language to the values of projects
built on top of it. To that extent, the success of the language is also
largely correlated to its popularity.
At the end of the day, 3000 bad Java developers are still manageable. I
doubt you want to work with 3000 bad FP developers at all. Exactly one of
the reason FP is not going anywhere.

【在 d*******i 的大作中提到】
: * Not having preference of functional programming vs object oriented
: functional programming
: * Not Talking which language is better than the other. They have different
: ways/benefits/tradeoff to resolve the issues.
: * Just want the topic of functional programming to be technical oriented.
: * Industrial wide popularity does not mean any success of the language.
: Actually it is a sadness of the language. I like Java, but when I worked
: with a global fortune 100 client who has 3000 offshore cheap "developers"
: fuc*Ng up Java everyday, I do not like my daily job any more. But that is
: how enterprise makes the popular language and their standards.

E*****m
发帖数: 25615
142

Let me put it this way, you don't know my job and I've no interest to
tell you. But your speculations are all wrong.
And, I can assure you I've know enough people with more than 10 years
of java experience.
Let me say that again. Your prediction about Java was about
5 YEARS AFTER IBM rolled out its Java product. You call that "early"! Why?

【在 g*****g 的大作中提到】
: Just ask how many people on this BBS have 10+ years of Java experience.
: And you know why I am an early adopter.
: BTW, academic experience doesn't count. I can see you don't have much
: industry experience that's why you make a fuss on everything.
:
: be
: really

m*********t
发帖数: 527
143
比如我有一个 float 数组(长度大约 10^8 to 10^9,占用几个 G 的内存),然后我用
成千上万个 thread 来计算然后 update 数组里面元素的内容(为了保证 thread 不冲
突算法和 sync 都需要考虑)。而如果用 immutable 在这个情况怎么处理?

do
the
object

【在 d*******i 的大作中提到】
: Not quite understanding what you mean. Answer your question in assumption.
: immutable objects does not mean that can not be garbage collected. I would
: rather call it as immutable arguments rather than objects. As long as you do
: not have reference with that argument, it can be garbage collected. On the
: other hand, it saves memory, since you can only keep one copy of that object
: and being reused by all the threads/cores, same concept as singleton.
: Talking about performance. People do criticize the the way of "change"
: immutable value, since you have to create another value by using the deep
: copies. But clojure using some techniques called "Sharing Tech" to avoid
: deep copy which is fast

g*****g
发帖数: 34805
144
你小被鄙视,就是因为明明没啥业界经验,还要成天指点江山。我老00年开始用jsp写
网站,只不过02年才觉得java比C++有前途。你觉不觉我是不是early有用吗?看看你周
围有多少人有10年java经验不就得了。

?

【在 E*****m 的大作中提到】
:
: Let me put it this way, you don't know my job and I've no interest to
: tell you. But your speculations are all wrong.
: And, I can assure you I've know enough people with more than 10 years
: of java experience.
: Let me say that again. Your prediction about Java was about
: 5 YEARS AFTER IBM rolled out its Java product. You call that "early"! Why?

s***o
发帖数: 6934
145
I agree with most of you points.
but the last one just has no base at all. bad developers are bad developers,
they are cancer no matter what language they use.

why

【在 g*****g 的大作中提到】
: I am not against anyone using FP in a niche domain. I am merely talking why
: existing FPs won't see massive adoption as a general purpose language.
: I tend to quantify the success of the language to the values of projects
: built on top of it. To that extent, the success of the language is also
: largely correlated to its popularity.
: At the end of the day, 3000 bad Java developers are still manageable. I
: doubt you want to work with 3000 bad FP developers at all. Exactly one of
: the reason FP is not going anywhere.

s***o
发帖数: 6934
146
这好像已经超出了编程解决实际问题的范畴,而是艺术欣赏的范畴了。不然不可能得出
这个结论:
”Industrial wide popularity does not mean any success of the language.
Actually it is a sadness of the language“

【在 d*******i 的大作中提到】
: * Not having preference of functional programming vs object oriented
: functional programming
: * Not Talking which language is better than the other. They have different
: ways/benefits/tradeoff to resolve the issues.
: * Just want the topic of functional programming to be technical oriented.
: * Industrial wide popularity does not mean any success of the language.
: Actually it is a sadness of the language. I like Java, but when I worked
: with a global fortune 100 client who has 3000 offshore cheap "developers"
: fuc*Ng up Java everyday, I do not like my daily job any more. But that is
: how enterprise makes the popular language and their standards.

y***a
发帖数: 840
147
you would probabaly be intereted in delite project

dsl

【在 G***l 的大作中提到】
: 简答来说就是做一个parser生成AST,跟相应的interpreter。比如一个basic语法的dsl
: ,当然我的肯定不会有一个正式的语言那么复杂。
:
: 是。

g*****g
发帖数: 34805
148
There's a difference on how much a bad developer can kill a project.

【在 s***o 的大作中提到】
: 这好像已经超出了编程解决实际问题的范畴,而是艺术欣赏的范畴了。不然不可能得出
: 这个结论:
: ”Industrial wide popularity does not mean any success of the language.
: Actually it is a sadness of the language“

E*****m
发帖数: 25615
149

真的不騙你, 我周遭超過10年Java 經驗的車載斗量, 我自己在 02年以前就做了幾個
Java 業界的項目, 你鄙視有用嗎?
02 年也好意思叫預測, 你的臉皮厚度可以直接當裝甲防護罩了。

【在 g*****g 的大作中提到】
: 你小被鄙视,就是因为明明没啥业界经验,还要成天指点江山。我老00年开始用jsp写
: 网站,只不过02年才觉得java比C++有前途。你觉不觉我是不是early有用吗?看看你周
: 围有多少人有10年java经验不就得了。
:
: ?

t*s
发帖数: 1504
150
俺家当初订阅了一份报纸,叫电脑商情报
我记得97 98年开始,那报纸上面就整天宣传java改变世界了。国内最开始java的那批
人我认为是从1.0开始就追捧的。

【在 E*****m 的大作中提到】
:
: 真的不騙你, 我周遭超過10年Java 經驗的車載斗量, 我自己在 02年以前就做了幾個
: Java 業界的項目, 你鄙視有用嗎?
: 02 年也好意思叫預測, 你的臉皮厚度可以直接當裝甲防護罩了。

相关主题
我还是认为scala的程序员水平高functional programming 哪本书经典适合入门
clojure这语言真不错也谈OOP跟FP之争
大牛给讲讲monad吧?OOP里面的Object其实是actor
进入Programming版参与讨论
p*****2
发帖数: 21240
151

我应该是98年学的Java,当时觉得确实简单。随便看了看书做了一个东西花了两个多小
时,后来转到VC上花了我一晚上,况且我还是搞VC的。不过后来总觉得语言不灵活,所
以一直不太愿意转过去。但是有的时候想做点小程序,还是觉得Java比C++方便和快速
很多。后来接触了了脚本语言,发觉做点小东西脚本就够了。

【在 t*s 的大作中提到】
: 俺家当初订阅了一份报纸,叫电脑商情报
: 我记得97 98年开始,那报纸上面就整天宣传java改变世界了。国内最开始java的那批
: 人我认为是从1.0开始就追捧的。

E*****m
发帖数: 25615
152

goodbug 會說別人都是跟風,只有他才是實在的。 等等看是不是這樣。

【在 t*s 的大作中提到】
: 俺家当初订阅了一份报纸,叫电脑商情报
: 我记得97 98年开始,那报纸上面就整天宣传java改变世界了。国内最开始java的那批
: 人我认为是从1.0开始就追捧的。

a*****e
发帖数: 1700
153
LOL, 这是要比谁最先搞 java 吗?我 97 年写的 Java 程序后来卖给Yahoo和华渊网。
后来再也没碰过 Java,所以 J2EE 这些我完全没接触过,不敢再古德霸面前抖啊,哈
哈哈

【在 p*****2 的大作中提到】
:
: 我应该是98年学的Java,当时觉得确实简单。随便看了看书做了一个东西花了两个多小
: 时,后来转到VC上花了我一晚上,况且我还是搞VC的。不过后来总觉得语言不灵活,所
: 以一直不太愿意转过去。但是有的时候想做点小程序,还是觉得Java比C++方便和快速
: 很多。后来接触了了脚本语言,发觉做点小东西脚本就够了。

g****r
发帖数: 1589
154
ca,这里全是前辈啊,我98年才摸到电脑这个东西,99年才在中学的机房里开始敲
basic,,,

【在 a*****e 的大作中提到】
: LOL, 这是要比谁最先搞 java 吗?我 97 年写的 Java 程序后来卖给Yahoo和华渊网。
: 后来再也没碰过 Java,所以 J2EE 这些我完全没接触过,不敢再古德霸面前抖啊,哈
: 哈哈

p*****2
发帖数: 21240
155

BSO年轻呀

【在 g****r 的大作中提到】
: ca,这里全是前辈啊,我98年才摸到电脑这个东西,99年才在中学的机房里开始敲
: basic,,,

t*****n
发帖数: 4908
156
用tubro c++的飘过。。。

【在 p*****2 的大作中提到】
:
: BSO年轻呀

l*********s
发帖数: 5409
157
BSO老江湖阿

【在 t*****n 的大作中提到】
: 用tubro c++的飘过。。。
g*****g
发帖数: 34805
158
LOL,不是读书写过一个applet就叫业界经验了,省省吧。02年在这BBS看好java的人很
少,要不然我
何必写那样的帖子。我老说的东西,好歹有10年前的帖子为证。你小明明半路出家,还
车载斗量呢,装逼有意思吗。

【在 E*****m 的大作中提到】
:
: goodbug 會說別人都是跟風,只有他才是實在的。 等等看是不是這樣。

g*****g
发帖数: 34805
159
如果我是跟风的,精华区也轮不到我来鼓吹。JSP 99年才出来的,我00年初用JSP写网
站的时候,是国内最早的一批,那时候更流行的是ASP和PHP。而在JSP出来之前,Java
的定位还局限于applet,没多大前途。你一吹就吹破了。

【在 E*****m 的大作中提到】
:
: goodbug 會說別人都是跟風,只有他才是實在的。 等等看是不是這樣。

E*****m
发帖数: 25615
160

你不是真神,亂猜做啥? 誰告訴你是 applet 了? 是正經用來賺錢的東西。
你也不知道我在哪幹, 氣急敗壞的跳上跳下是覺得人品還沒丟光嗎?
這 BBS 就是你的全部社會關係是嗎? 02 年在這裡『預測』Java 也好意思說?
真是好了不起, 連自己在丟人現眼都還不自覺,還留著丟人的證據到處獻寶,
不服你還真不行。

【在 g*****g 的大作中提到】
: LOL,不是读书写过一个applet就叫业界经验了,省省吧。02年在这BBS看好java的人很
: 少,要不然我
: 何必写那样的帖子。我老说的东西,好歹有10年前的帖子为证。你小明明半路出家,还
: 车载斗量呢,装逼有意思吗。

相关主题
怎么这里这么多人学pythongo几天的一些感受
粉FP的人是因为把电脑想象成图灵机了Haskell很难学。。
学FP不是为了写代码, 而是为了优秀的架构.FP更接近人的思维
进入Programming版参与讨论
r********n
发帖数: 7441
161
拆分后每个子任务在一个core上以独占方式跑

【在 p*****2 的大作中提到】
:
: BSO年轻呀

E*****m
发帖数: 25615
162

Java
你的志氣大概就是『國內』,『mitbbs』 這些地方是吧?
2002, Eclipse 都出來了, 更早前, Java 市場早就已經一片火熱了,Visual J++,
Visual Age for Java, Borland Jbuilder 這些早就 出好幾版了, MS 都已經推出 C
#了。
用 Java 寫 desktop application 早就流行了。 你要是 00 年給大家推薦用 Java

web 倒也還算早, 02 年就算太晚了。

【在 g*****g 的大作中提到】
: 如果我是跟风的,精华区也轮不到我来鼓吹。JSP 99年才出来的,我00年初用JSP写网
: 站的时候,是国内最早的一批,那时候更流行的是ASP和PHP。而在JSP出来之前,Java
: 的定位还局限于applet,没多大前途。你一吹就吹破了。

g*****g
发帖数: 34805
163
LOL,我老是有帖子做证据的,你小全靠上下嘴皮一翻,还证据呢?
我老00年开始写jsp应用,还不能叫early adopter,你丫不装逼会死吗?

【在 E*****m 的大作中提到】
:
: Java
: 你的志氣大概就是『國內』,『mitbbs』 這些地方是吧?
: 2002, Eclipse 都出來了, 更早前, Java 市場早就已經一片火熱了,Visual J++,
: Visual Age for Java, Borland Jbuilder 這些早就 出好幾版了, MS 都已經推出 C
: #了。
: 用 Java 寫 desktop application 早就流行了。 你要是 00 年給大家推薦用 Java
: 寫
: web 倒也還算早, 02 年就算太晚了。

g*****g
发帖数: 34805
164
我老00年写的网站就用jsp,还不算早?我老觉得Java写desktop app没前途,所以更早
没吹呀,要不
怎么说比你小有眼光呢?

,
C

【在 E*****m 的大作中提到】
:
: Java
: 你的志氣大概就是『國內』,『mitbbs』 這些地方是吧?
: 2002, Eclipse 都出來了, 更早前, Java 市場早就已經一片火熱了,Visual J++,
: Visual Age for Java, Borland Jbuilder 這些早就 出好幾版了, MS 都已經推出 C
: #了。
: 用 Java 寫 desktop application 早就流行了。 你要是 00 年給大家推薦用 Java
: 寫
: web 倒也還算早, 02 年就算太晚了。

E*****m
发帖数: 25615
165

jsp 寫個 hello world? 那麼愛講有存貼證據, 你把 00 年寫 JSP 的證據拿出來看
一下。

【在 g*****g 的大作中提到】
: 我老00年写的网站就用jsp,还不算早?我老觉得Java写desktop app没前途,所以更早
: 没吹呀,要不
: 怎么说比你小有眼光呢?
:
: ,
: C

g*****g
发帖数: 34805
166
00年ChinaRen有一部分是用JSP写的,现在网站是大不一样了,但还是JSP。
http://class.chinaren.com/index.jsp?bru=%2Fhome.do
你小02年拿Java写业界项目的证据呢?

【在 E*****m 的大作中提到】
:
: jsp 寫個 hello world? 那麼愛講有存貼證據, 你把 00 年寫 JSP 的證據拿出來看
: 一下。

c****e
发帖数: 1453
167
黄金时代阿, 那个时候给chinaren作parttime也有几千块一个月。

【在 g*****g 的大作中提到】
: 00年ChinaRen有一部分是用JSP写的,现在网站是大不一样了,但还是JSP。
: http://class.chinaren.com/index.jsp?bru=%2Fhome.do
: 你小02年拿Java写业界项目的证据呢?

b***e
发帖数: 1419
168
That's controversial. Why would there be 3k bad Java developer at first
place? Maybe it's too easy to be a bad Java developer. For Haskell, you
either are a good developer, or you cannot use it at all coz you're just too
dumb to understand it.

why

【在 g*****g 的大作中提到】
: I am not against anyone using FP in a niche domain. I am merely talking why
: existing FPs won't see massive adoption as a general purpose language.
: I tend to quantify the success of the language to the values of projects
: built on top of it. To that extent, the success of the language is also
: largely correlated to its popularity.
: At the end of the day, 3000 bad Java developers are still manageable. I
: doubt you want to work with 3000 bad FP developers at all. Exactly one of
: the reason FP is not going anywhere.

g*****g
发帖数: 34805
169
It's simply demand and supply. When demand is way over than supply,
everybody and their grandma can be a java developer. On the other hand, it
may take a genius to understand Haskell, yet some of them are still jobless,
too bad.

too

【在 b***e 的大作中提到】
: That's controversial. Why would there be 3k bad Java developer at first
: place? Maybe it's too easy to be a bad Java developer. For Haskell, you
: either are a good developer, or you cannot use it at all coz you're just too
: dumb to understand it.
:
: why

b***e
发帖数: 1419
170
Hmmm...I've seen enough java developers out of job, never seen a Haskell
developer out of job.

jobless,

【在 g*****g 的大作中提到】
: It's simply demand and supply. When demand is way over than supply,
: everybody and their grandma can be a java developer. On the other hand, it
: may take a genius to understand Haskell, yet some of them are still jobless,
: too bad.
:
: too

相关主题
FP更接近人的思维王垠新文 为Java说句公道话
有没有喜欢haskell的同学我对为什么使用FP的理解 (补)
对 (im)mutability 的误解和深度理解模板算是纯FP吗
进入Programming版参与讨论
g*****g
发帖数: 34805
171
You probably know more java developers than total Haskell positions existing.

【在 b***e 的大作中提到】
: Hmmm...I've seen enough java developers out of job, never seen a Haskell
: developer out of job.
:
: jobless,

b***e
发帖数: 1419
172
That's true. I know tons of J2EE experts who used to be tailors or chefs or
mailmen from "you know where". Guess that's why people are complaining H1B
is used up. But the point is, I did never see "some of the functional
programmers cannot land a job", while I do see quite "some of the (claimed
to be) Java developers cannot land a job". I personal interviewed many Java
developers with more than 10 year experience, and they cannot write a
simple exponential function correctly.

existing.

【在 g*****g 的大作中提到】
: You probably know more java developers than total Haskell positions existing.
g*****g
发帖数: 34805
173
If your so claimed functional programmers did not land a job as a functional
programmer, they are not a functional programmer. Or they are a jobless
functional programmer. Plain and simple.
When you can find a ton of bad java programmers employed, you know for sure
a good java programmer can get a good paycheck. That's the point.
The remaining Cobol programmers are probably very good, that doesn't mean
Cobol isn't dead.

or
H1B
Java

【在 b***e 的大作中提到】
: That's true. I know tons of J2EE experts who used to be tailors or chefs or
: mailmen from "you know where". Guess that's why people are complaining H1B
: is used up. But the point is, I did never see "some of the functional
: programmers cannot land a job", while I do see quite "some of the (claimed
: to be) Java developers cannot land a job". I personal interviewed many Java
: developers with more than 10 year experience, and they cannot write a
: simple exponential function correctly.
:
: existing.

d*******i
发帖数: 77
174
Talking with goodbug is like talking with American Java Enterprise architect
working in a same company for many years. As I do short term consulting, I
know a lot of these dudes.
Basically the words are dictating and no logic. Like "Plain and simple", "
You know for sure", "That is the point". If you see those statements, not
plain, either simple. I can not know for sure and not that point. In a real
life, you can beat the architects by using codes and white board. But in
BBS, you have to lose to someone with 10 years bbs tenure, while same cases
you have to back out when at client sites, the 10 years chief architects
saying, this is the point, you do not understand since I've been here 1
million years.
Bye!~ Backing out.

functional
sure

【在 g*****g 的大作中提到】
: If your so claimed functional programmers did not land a job as a functional
: programmer, they are not a functional programmer. Or they are a jobless
: functional programmer. Plain and simple.
: When you can find a ton of bad java programmers employed, you know for sure
: a good java programmer can get a good paycheck. That's the point.
: The remaining Cobol programmers are probably very good, that doesn't mean
: Cobol isn't dead.
:
: or
: H1B

g*****g
发帖数: 34805
175
LOL, are you serious about logic? Ironically I am the one who always brings
out numbers and killers app when comparing languages. Programming is all
about practicability. All these functional languages provocatives, they talk
about art and beauty instead.
I use the same arguments ten years ago, simply because history proved my
principles were correct, while people in opposition was wrong. Now time has
changed, but the stance isn't. I am merely asking one question, what changes
have given FP new edge? I haven't heard any.
Learning a language is like buying a stock. You can pick a winner and
constantly compare it to its competition. Or you can pick a loser and boast
it all day long. We all hope to make money out of it, and the feeling is
hurt when we are on the wrong side.

architect
I
real
cases

【在 d*******i 的大作中提到】
: Talking with goodbug is like talking with American Java Enterprise architect
: working in a same company for many years. As I do short term consulting, I
: know a lot of these dudes.
: Basically the words are dictating and no logic. Like "Plain and simple", "
: You know for sure", "That is the point". If you see those statements, not
: plain, either simple. I can not know for sure and not that point. In a real
: life, you can beat the architects by using codes and white board. But in
: BBS, you have to lose to someone with 10 years bbs tenure, while same cases
: you have to back out when at client sites, the 10 years chief architects
: saying, this is the point, you do not understand since I've been here 1

b***e
发帖数: 1419
176
Well, if that's by definition your logic, then I certainly cannot beat you
on it. But I disagree. To your point, you can similarly argue most of the
PHDs hired by Google or Facebook are jobless computer science researchers.
In my opinion, a functional developer, as smart and capable she/he is,
usually lands a good job easily, regardless if the job is directly related
to functional programming or not. The thoughts and insights gained from
understanding functional languages is beyond merely using them as
development tools.

functional
sure

【在 g*****g 的大作中提到】
: If your so claimed functional programmers did not land a job as a functional
: programmer, they are not a functional programmer. Or they are a jobless
: functional programmer. Plain and simple.
: When you can find a ton of bad java programmers employed, you know for sure
: a good java programmer can get a good paycheck. That's the point.
: The remaining Cobol programmers are probably very good, that doesn't mean
: Cobol isn't dead.
:
: or
: H1B

g*****g
发帖数: 34805
177
Your logic is twisted. A good developer is good because he/she can get the
job done. Not because he/she can do FP. Do you have any statistics to prove
developers that know FP are better? If not, this self-claimed superiority is
nothing but zhuangbility.

the

【在 b***e 的大作中提到】
: Well, if that's by definition your logic, then I certainly cannot beat you
: on it. But I disagree. To your point, you can similarly argue most of the
: PHDs hired by Google or Facebook are jobless computer science researchers.
: In my opinion, a functional developer, as smart and capable she/he is,
: usually lands a good job easily, regardless if the job is directly related
: to functional programming or not. The thoughts and insights gained from
: understanding functional languages is beyond merely using them as
: development tools.
:
: functional

E*****m
发帖数: 25615
178

prove
is
Question for you. Does arguing this make more money for you?
If yes, how? If not, are you 裝B ing ?

【在 g*****g 的大作中提到】
: Your logic is twisted. A good developer is good because he/she can get the
: job done. Not because he/she can do FP. Do you have any statistics to prove
: developers that know FP are better? If not, this self-claimed superiority is
: nothing but zhuangbility.
:
: the

g*****g
发帖数: 34805
179
Java developers make much more money than Haskell developers, that's just a
fact.
Since when stating fact is also zhuangbility?
http://www.indeed.com/salary?q1=java&l1=&q2=haskell&l2=&tm=1
Where's your proof of industry java project in 2002 BTW? You were exposed
the other day and now you are back again?

【在 E*****m 的大作中提到】
:
: prove
: is
: Question for you. Does arguing this make more money for you?
: If yes, how? If not, are you 裝B ing ?

A*******t
发帖数: 443
180
http://www.indeed.com/salary?q1=java&l1=&q2=Ocaml&l2=&tm=1
不过估计是Jane Street一家之力

a

【在 g*****g 的大作中提到】
: Java developers make much more money than Haskell developers, that's just a
: fact.
: Since when stating fact is also zhuangbility?
: http://www.indeed.com/salary?q1=java&l1=&q2=haskell&l2=&tm=1
: Where's your proof of industry java project in 2002 BTW? You were exposed
: the other day and now you are back again?

相关主题
批判 goclojure这语言真不错
1st class citizen大牛给讲讲monad吧?
我还是认为scala的程序员水平高functional programming 哪本书经典适合入门
进入Programming版参与讨论
E*****m
发帖数: 25615
181

a
Now you think there are other thing than money that you care?
If you didn't understand the question, I'm asking does YOU arguing this
make YOU more money? Can you answer this?
Did I promise I'll prove it to you? No. You don't need to believe me. It's
not even
the point. You can't defend your own argument, so you have to resort to
personal attach. So pathetic.

【在 g*****g 的大作中提到】
: Java developers make much more money than Haskell developers, that's just a
: fact.
: Since when stating fact is also zhuangbility?
: http://www.indeed.com/salary?q1=java&l1=&q2=haskell&l2=&tm=1
: Where's your proof of industry java project in 2002 BTW? You were exposed
: the other day and now you are back again?

a****i
发帖数: 1182
182
you need not answer this nonsense question
everyone posts here for money or zhuangB?
Did he try to answer the question before he asked?
or M$ pays him for arguing here

a

【在 g*****g 的大作中提到】
: Java developers make much more money than Haskell developers, that's just a
: fact.
: Since when stating fact is also zhuangbility?
: http://www.indeed.com/salary?q1=java&l1=&q2=haskell&l2=&tm=1
: Where's your proof of industry java project in 2002 BTW? You were exposed
: the other day and now you are back again?

E*****m
发帖数: 25615
183

Actually, this is goodbug's idea. He thinks only money is
important, everything else is zhuangB.

【在 a****i 的大作中提到】
: you need not answer this nonsense question
: everyone posts here for money or zhuangB?
: Did he try to answer the question before he asked?
: or M$ pays him for arguing here
:
: a

g*****g
发帖数: 34805
184
Not really, I am just disgusted by someone's self-claim superiority.
Some people feel they are better programmers because they know FP, but they
don't have any number to back it up, they don't even program FP for a living
. Now that's textbook zhuangB.
Money is not everything. But at least that's a number that's objective and
easy to find on Internet.

【在 E*****m 的大作中提到】
:
: Actually, this is goodbug's idea. He thinks only money is
: important, everything else is zhuangB.

g*****g
发帖数: 34805
185
Good find. Though only 43 jobs compared to 66K for Java. It's more or less a
skill to kill the dragon.
http://www.indeed.com/jobs?q=Ocaml&l=

【在 A*******t 的大作中提到】
: http://www.indeed.com/salary?q1=java&l1=&q2=Ocaml&l2=&tm=1
: 不过估计是Jane Street一家之力
:
: a

b***e
发帖数: 1419
186
I didn't get it where my logic is twisted. Therefore I prefer to question
your skills of reading comprehension. Nonetheless, with my limited personal
experience, I do observe average FP developers exhibiting much more
superior smartness and capability over Java developers (I did work in both
contexts for non-trivial/significant time). Also, to my observation FP
developers are either making more of a fortune or getting a better social
status than mere Java developers.

prove
is

【在 g*****g 的大作中提到】
: Your logic is twisted. A good developer is good because he/she can get the
: job done. Not because he/she can do FP. Do you have any statistics to prove
: developers that know FP are better? If not, this self-claimed superiority is
: nothing but zhuangbility.
:
: the

g*****g
发帖数: 34805
187
Your observation. LOL. Do you know 4 big cows in this BBS?
My friends, my relatives, my neighbors and my classmates.
I show numbers to prove FP programmers would have a hard time to find a job.
Many of your brilliant FP programmers are stuck in thousand year postdoc,
you can't find a good explanation otherwisefor $28K average salary for
Haskell jobs.
And to show you why personal observation can be so biased. Most of java
programmers in my company make more than $200K a year. If they work for more
than 3 years in the company they are most likely a millionaire due to stock
option. But I wouldn't use that personal observation to generalize social
status for a language's developers like you just did.

personal

【在 b***e 的大作中提到】
: I didn't get it where my logic is twisted. Therefore I prefer to question
: your skills of reading comprehension. Nonetheless, with my limited personal
: experience, I do observe average FP developers exhibiting much more
: superior smartness and capability over Java developers (I did work in both
: contexts for non-trivial/significant time). Also, to my observation FP
: developers are either making more of a fortune or getting a better social
: status than mere Java developers.
:
: prove
: is

E*****m
发帖数: 25615
188

they
living
Hitting strawman?
NOW money is not everything? So, what else is important?

【在 g*****g 的大作中提到】
: Not really, I am just disgusted by someone's self-claim superiority.
: Some people feel they are better programmers because they know FP, but they
: don't have any number to back it up, they don't even program FP for a living
: . Now that's textbook zhuangB.
: Money is not everything. But at least that's a number that's objective and
: easy to find on Internet.

g*****g
发帖数: 34805
189
Like humble and not zhuangB even if you know how to kill a dragon.

【在 E*****m 的大作中提到】
:
: they
: living
: Hitting strawman?
: NOW money is not everything? So, what else is important?

b***e
发帖数: 1419
190
I question the accuracy of the Haskell developer salary report, well, yes,
depending on how do you classify Haskell developers. Most of the Haskell
developers are truly academic researchers. Those people who worked with me
before are mostly tenure professors at some universities. So far I didn't
find a single case in my list of 4 big cows who's "thousand years of post-
doc". This is not biology (sorry for my candor, biologists). They might
not be making as high as 200k per year as far as base salary is concerned,
but undeniably, they are at a higher social status and earn more
professional respects than mere Java developers. Their contribution to
science and to the development of human society is not measured through how
many dollars they make per year.
On the other hand, even if people who are a bit dumber than those smart
asses, like me, who ended up in the software industry, are benefiting from
the valuable experience from programming functional languages. As I said in
another post, the insights that people gain from understanding how FPLs
work can great improve the personal's vision in software engineering. For
an instance, like Wang Yin said, visitor pattern doesn't exist in Haskell (
as a representative of FPL), because it's just a language feature. That
being said, if you did program Haskell and understand how pattern matching
works there, you would have a much better understanding of why the visitor
pattern is constructed that way. That's know-why, which beyond a mere know-
how. Furthermore, with the involvement of Java generics, sometimes there
are variants of visitor patterns that are pretty hacky and tricky. But if
you did know that there's something call Generalized Algebraic Datatype (
GADT) in Haskell, you would realized those hacks are not totally out of
nowhere from some smart-ass' mind. They are just mimicking the enhanced
pattern matching in GADT. This is know-why again, which is beyond a mere
know-how. Only with know-how can you be original and creative to create new
patterns that suite new needs.
I do not merely take a programming language as a development tool and get
religious about it. I tend to see through the surface and reach the essence
. When I look at Haskell, I see Algebraic Data Type and type directed
pattern matching, I see non-strictness/lazy evaluation, I see functional
closures and lambda lifting, I see type/constructor class based overloading,
I see implicit parameters, I see monad based side effects. When I look at
Lisp, I see meta programming, I see macros, I see CLOS, I see explicit
continuation passing. When I see Java, I see object oriented paradigm, I
see OO based encapsulation, I see inclusion polymorphism (subtyping), I see
singly inheritance hierarchy with interfaces, I see garbage collection, I
see just-in-time compilation, and I see weak references. When I see Scala,
I see mixins, I see type inference for second order polymorphism, I see
light-weight lock free processes.
If your final career goal is to be a senior^n Java engineer and get
comfortable with 200k yearly income and enjoy it for the rest of your life,
that's good for you. I had been there and done that years ago, and I moved
on beyond that.

job.
more
stock

【在 g*****g 的大作中提到】
: Your observation. LOL. Do you know 4 big cows in this BBS?
: My friends, my relatives, my neighbors and my classmates.
: I show numbers to prove FP programmers would have a hard time to find a job.
: Many of your brilliant FP programmers are stuck in thousand year postdoc,
: you can't find a good explanation otherwisefor $28K average salary for
: Haskell jobs.
: And to show you why personal observation can be so biased. Most of java
: programmers in my company make more than $200K a year. If they work for more
: than 3 years in the company they are most likely a millionaire due to stock
: option. But I wouldn't use that personal observation to generalize social

相关主题
也谈OOP跟FP之争粉FP的人是因为把电脑想象成图灵机了
OOP里面的Object其实是actor学FP不是为了写代码, 而是为了优秀的架构.
怎么这里这么多人学pythongo几天的一些感受
进入Programming版参与讨论
g*****g
发帖数: 34805
191
It's one thing saying learning FP can benefit programming skills, which I
definitely agree. It's another thing saying FP programmers are better than
Java programmers, which is really a joke. They can't even find a job as a FP
programmers, if better means killing dragon, sure, but nobody really cares.
There are a lot of things to learn and all of them can have some benefits,
the question is how much? Personally I believe no matter what programming
language you are using, mastering the mainstream frameworks and getting keen
on the hot technologies like NoSQL, Cloud etc. is more beneficial than
learning FP. But it's your own choice.
At the end of the day, however, programming is an engineering practice. The
end products prove the usefulness of the language and the skills the
programmers practicing them. It's not that difficult to quantify. You just
have nothing to back up your claims with the worlds full of Java products
and FP products hard to find. Talk is cheap. How much you or me earn is not
the matter. The matter is not to talk bullshit and only proof is the four
big cows you know, which is still all you have with your long thesis, that's
not gonna work for techies.

me
how

【在 b***e 的大作中提到】
: I question the accuracy of the Haskell developer salary report, well, yes,
: depending on how do you classify Haskell developers. Most of the Haskell
: developers are truly academic researchers. Those people who worked with me
: before are mostly tenure professors at some universities. So far I didn't
: find a single case in my list of 4 big cows who's "thousand years of post-
: doc". This is not biology (sorry for my candor, biologists). They might
: not be making as high as 200k per year as far as base salary is concerned,
: but undeniably, they are at a higher social status and earn more
: professional respects than mere Java developers. Their contribution to
: science and to the development of human society is not measured through how

n******t
发帖数: 4406
192
But not many people make money directly from knowing functional programming
language. On the other hand, I think any job,that pays your directly because
you are using a particular language, is not so good as a job. It can give
you are decent life maybe, but might be not all that interesting.
Knowing a language that is not popular in industry and still learning or
even mastering it, could be an evidence the learner is interested in various
programming aspects and are probably more skillful than the normal
"learn-something-to-get-a-job" type of programmer. Very few programmers who
know FP just know FP. Most of them knows enough C/C++/Java before that and
they are probably going to learn a lot more in the future. So in this
regard, it is probably right to say FP programmer are usually better in
probablity. It does not mean learning Java means you are stupid though.

FP
cares.
keen
The

【在 g*****g 的大作中提到】
: It's one thing saying learning FP can benefit programming skills, which I
: definitely agree. It's another thing saying FP programmers are better than
: Java programmers, which is really a joke. They can't even find a job as a FP
: programmers, if better means killing dragon, sure, but nobody really cares.
: There are a lot of things to learn and all of them can have some benefits,
: the question is how much? Personally I believe no matter what programming
: language you are using, mastering the mainstream frameworks and getting keen
: on the hot technologies like NoSQL, Cloud etc. is more beneficial than
: learning FP. But it's your own choice.
: At the end of the day, however, programming is an engineering practice. The

G***l
发帖数: 355
193
你又犯晕了。我没看到有人说FP programmer programmer比java好,至少几个发言比较
多的id都没这么说。事实上除了acdemic之外,绝大多数fp progammer同时也大量使用
java,c#,c++,python这些非fp语言。完全是你有受迫害妄想症,看到别人说fp好,就偏
要往别人意思是java不好联想,看到比人说fp有前途就往java没前途去理解。我对这个
thread里面你的观点鉴定完毕。

FP
cares.
keen
The

【在 g*****g 的大作中提到】
: It's one thing saying learning FP can benefit programming skills, which I
: definitely agree. It's another thing saying FP programmers are better than
: Java programmers, which is really a joke. They can't even find a job as a FP
: programmers, if better means killing dragon, sure, but nobody really cares.
: There are a lot of things to learn and all of them can have some benefits,
: the question is how much? Personally I believe no matter what programming
: language you are using, mastering the mainstream frameworks and getting keen
: on the hot technologies like NoSQL, Cloud etc. is more beneficial than
: learning FP. But it's your own choice.
: At the end of the day, however, programming is an engineering practice. The

g*****g
发帖数: 34805
194

你就别圆了,这位底下写得清清楚楚,FP programmer从IQ,fortune, social status
全方
位完灭java developer。我老就是要他提供一些数字来证明一下,这位就开始玩四大牛
人的把戏。
我没啥迫害妄想症,那位blaze 10年前就鼓吹过Haskell,跟我争过FP会如何牛逼云云
,你不信可以去google,事实上是这10年,FP的地位几乎没有提高,倒是他看不起的
Java地位提高了很多。他就是老脸拉不下来。
personal

【在 G***l 的大作中提到】
: 你又犯晕了。我没看到有人说FP programmer programmer比java好,至少几个发言比较
: 多的id都没这么说。事实上除了acdemic之外,绝大多数fp progammer同时也大量使用
: java,c#,c++,python这些非fp语言。完全是你有受迫害妄想症,看到别人说fp好,就偏
: 要往别人意思是java不好联想,看到比人说fp有前途就往java没前途去理解。我对这个
: thread里面你的观点鉴定完毕。
:
: FP
: cares.
: keen
: The

g*****g
发帖数: 34805
195
As I mentioned, there are so much to learn in programming. What's so special
about FP? There's simply no proof learning FP is more beneficial than using
the time to learn other things like new frameworks and technologies.

programming
because
various
who

【在 n******t 的大作中提到】
: But not many people make money directly from knowing functional programming
: language. On the other hand, I think any job,that pays your directly because
: you are using a particular language, is not so good as a job. It can give
: you are decent life maybe, but might be not all that interesting.
: Knowing a language that is not popular in industry and still learning or
: even mastering it, could be an evidence the learner is interested in various
: programming aspects and are probably more skillful than the normal
: "learn-something-to-get-a-job" type of programmer. Very few programmers who
: know FP just know FP. Most of them knows enough C/C++/Java before that and
: they are probably going to learn a lot more in the future. So in this

g****t
发帖数: 31659
196
计算机本科的计算理论基础什么的,一般都要学FP吧?
就算不学商用FP,Lambda Calculus之类的东西,很多基础课本都有包括.
这个和图灵机类似.属于基本的基础.一个程序员,能没学过Turing机么?
虽然不一定有用.

As I mentioned, there are so much to learn in programming. What's so special
about FP? There's simply no proof learning FP is more beneficial than using
the time to learn other things like new frameworks and technologies.
programming
because
various
who

【在 g*****g 的大作中提到】
: As I mentioned, there are so much to learn in programming. What's so special
: about FP? There's simply no proof learning FP is more beneficial than using
: the time to learn other things like new frameworks and technologies.
:
: programming
: because
: various
: who

g*****g
发帖数: 34805
197
计算理论本来就不是必修课。就跟图像处理,图形学,人工智能,这些都是专业方向,
不是CS本科必修课。
我打赌这版上大多数人都没学过图像处理和图形学,但我不会说什么学过图形学的秒杀
没学过的云云。

special
using

【在 g****t 的大作中提到】
: 计算机本科的计算理论基础什么的,一般都要学FP吧?
: 就算不学商用FP,Lambda Calculus之类的东西,很多基础课本都有包括.
: 这个和图灵机类似.属于基本的基础.一个程序员,能没学过Turing机么?
: 虽然不一定有用.
:
: As I mentioned, there are so much to learn in programming. What's so special
: about FP? There's simply no proof learning FP is more beneficial than using
: the time to learn other things like new frameworks and technologies.
: programming
: because

g****t
发帖数: 31659
198
CS哪个课学图灵机? (或者哪个程序员对图灵机感兴趣。)
一般也都会学到Lambda Calculs,部分递归函数什么的。

计算理论本来就不是必修课。就跟图像处理,图形学,人工智能,这些都是专业方向,
不是CS本科必修课。
我打赌这版上大多数人都没学过图像处理和图形学,但我不会说什么学过图形学的秒杀
没学过的云云。
special
using

【在 g*****g 的大作中提到】
: 计算理论本来就不是必修课。就跟图像处理,图形学,人工智能,这些都是专业方向,
: 不是CS本科必修课。
: 我打赌这版上大多数人都没学过图像处理和图形学,但我不会说什么学过图形学的秒杀
: 没学过的云云。
:
: special
: using

g*****g
发帖数: 34805
199
形式语言与自动机,选修课。

【在 g****t 的大作中提到】
: CS哪个课学图灵机? (或者哪个程序员对图灵机感兴趣。)
: 一般也都会学到Lambda Calculs,部分递归函数什么的。
:
: 计算理论本来就不是必修课。就跟图像处理,图形学,人工智能,这些都是专业方向,
: 不是CS本科必修课。
: 我打赌这版上大多数人都没学过图像处理和图形学,但我不会说什么学过图形学的秒杀
: 没学过的云云。
: special
: using

A*******t
发帖数: 443
200
说得好像学了fp,连java都不会写了似的

a

【在 g*****g 的大作中提到】
: Good find. Though only 43 jobs compared to 66K for Java. It's more or less a
: skill to kill the dragon.
: http://www.indeed.com/jobs?q=Ocaml&l=

相关主题
Haskell很难学。。对 (im)mutability 的误解和深度理解
FP更接近人的思维王垠新文 为Java说句公道话
有没有喜欢haskell的同学我对为什么使用FP的理解 (补)
进入Programming版参与讨论
b***e
发帖数: 1419
201
事实上scala和javascript都属于FP,只不过不像Haskell那么纯粹。FP的本质在于对
first class function和higher order function的支持。
我对四大牛人什么的说实话不感兴趣。我十年前也并非鼓吹FP。当年你挑起一个帖子,
说你认为functional language programmer都是"freaks who cannot think straight"
(大体是你的原话吧)。我路见不平而已。其中是非曲直有目共睹。
我职业潜水员,一向不太发帖子,这次多说几句主要是你们这些Java轮bash FP过激了
。我一向鼓励对FP的兴趣和探究,不愿看到这些志向过早的为世俗所羁。或有矫枉过正
。言止此尔。

status

【在 g*****g 的大作中提到】
: 形式语言与自动机,选修课。
s***o
发帖数: 6934
202
why is there a line drawn between functional language programmers and non
functional language programmers? It's the first time I've heard of it. It's
stupid.

straight"

【在 b***e 的大作中提到】
: 事实上scala和javascript都属于FP,只不过不像Haskell那么纯粹。FP的本质在于对
: first class function和higher order function的支持。
: 我对四大牛人什么的说实话不感兴趣。我十年前也并非鼓吹FP。当年你挑起一个帖子,
: 说你认为functional language programmer都是"freaks who cannot think straight"
: (大体是你的原话吧)。我路见不平而已。其中是非曲直有目共睹。
: 我职业潜水员,一向不太发帖子,这次多说几句主要是你们这些Java轮bash FP过激了
: 。我一向鼓励对FP的兴趣和探究,不愿看到这些志向过早的为世俗所羁。或有矫枉过正
: 。言止此尔。
:
: status

h*i
发帖数: 3446
203
I can understand your frustration.
But, the truth of the matter is that a programmer who is versed in FP is
indeed considered by almost every employer as a better programmer than one
who is not versed in FP, everything else being equal. This is simply a fact.
You can be disgusted about the fact, but it does not change the fact.
If you are really practical minded as you seem to claim yourself to be, you
may want to work with the reality rather than whine about it.

they
living

【在 g*****g 的大作中提到】
: Not really, I am just disgusted by someone's self-claim superiority.
: Some people feel they are better programmers because they know FP, but they
: don't have any number to back it up, they don't even program FP for a living
: . Now that's textbook zhuangB.
: Money is not everything. But at least that's a number that's objective and
: easy to find on Internet.

h*i
发帖数: 3446
204
I am among those people who wrote almost exclusively in Java since 1997. I
was invited to Sun's dinners in Beijing and totally bought their propaganda
(compare with C++, Java was so much better). In those days, one could
easily win awards by writing Java applets, which I got a couple myself.
Later on, I even wrote 3D games in Java. Fun times...
Then Java became enterprisy, with all those frameworks and architecture
astronauts running the show, and lost all of its charm...
Now I wrote almost exclusively in Clojure...

【在 t*s 的大作中提到】
: 俺家当初订阅了一份报纸,叫电脑商情报
: 我记得97 98年开始,那报纸上面就整天宣传java改变世界了。国内最开始java的那批
: 人我认为是从1.0开始就追捧的。

h*i
发帖数: 3446
205
There isn't a line, but "FP programmers" are those programmers who can do FP
, "non-FP programmers" are those who cannot. Because all programmers can do
non-FP, and only "FP programmers" can do FP, "FP programmers" are normally
considered better programmers, everything else being equal.

s

【在 s***o 的大作中提到】
: why is there a line drawn between functional language programmers and non
: functional language programmers? It's the first time I've heard of it. It's
: stupid.
:
: straight"

h*i
发帖数: 3446
206
There's no such thing as a FP programmer who does not know how to program in
Java if they need to. If they can make a good living without doing that,
why should they. After all, a Java programmer is like a janitor these days,
it's a replaceable commodity because every one can do it.
Truth hurts.

FP
cares.
keen
The

【在 g*****g 的大作中提到】
: It's one thing saying learning FP can benefit programming skills, which I
: definitely agree. It's another thing saying FP programmers are better than
: Java programmers, which is really a joke. They can't even find a job as a FP
: programmers, if better means killing dragon, sure, but nobody really cares.
: There are a lot of things to learn and all of them can have some benefits,
: the question is how much? Personally I believe no matter what programming
: language you are using, mastering the mainstream frameworks and getting keen
: on the hot technologies like NoSQL, Cloud etc. is more beneficial than
: learning FP. But it's your own choice.
: At the end of the day, however, programming is an engineering practice. The

g*****g
发帖数: 34805
207
I am not frustrated, and why should I? If you are at all being about
practical, you should notice functional languages ain't spring chicken, in
fact, they've existed for much longer time than OO languages and they never
took off. Plus, there's absolutely no data supporting FP programmers are
better. If anything, the salary on indeed suggests their market value is
just lower, much lower. Now that's some fact.

fact.
you

【在 h*i 的大作中提到】
: I can understand your frustration.
: But, the truth of the matter is that a programmer who is versed in FP is
: indeed considered by almost every employer as a better programmer than one
: who is not versed in FP, everything else being equal. This is simply a fact.
: You can be disgusted about the fact, but it does not change the fact.
: If you are really practical minded as you seem to claim yourself to be, you
: may want to work with the reality rather than whine about it.
:
: they
: living

g*****g
发帖数: 34805
208
LOL, truth hurts, doesn't it?
http://www.indeed.com/salary?q1=haskell&l1=&q2=java&l2=&q3=sche
Not to mention Java jobs are like 10 times than all these languages combined.
If you are really good, in the normal distribution you can get in the far
right end.
By the way, your clojure peers ain't doing very well either. I feel sorry
for them.

in
,

【在 h*i 的大作中提到】
: There's no such thing as a FP programmer who does not know how to program in
: Java if they need to. If they can make a good living without doing that,
: why should they. After all, a Java programmer is like a janitor these days,
: it's a replaceable commodity because every one can do it.
: Truth hurts.
:
: FP
: cares.
: keen
: The

g*****g
发帖数: 34805
209
There's no such things as all things being equal. When people start marking
themselves "FP programmers" for self-claimed superiority while not holding
such a a job, it's like one boasting his dragon killing skills.
Normal people would be proud of what they do and do well, not what they don'
t do but they could do. I see severe confidence lacking here.

FP
do
normally

【在 h*i 的大作中提到】
: There isn't a line, but "FP programmers" are those programmers who can do FP
: , "non-FP programmers" are those who cannot. Because all programmers can do
: non-FP, and only "FP programmers" can do FP, "FP programmers" are normally
: considered better programmers, everything else being equal.
:
: s

c******n
发帖数: 4965
210
I don't really see the point of using functional programming languages for
real production projects, though clojure is very popular now.
my point is that in a few cases you do need to operate on functions, all
languages have such features: C has function pointers, java has anonymous
inner classes, python has lambda. it's just that they do not openly
advertise them as "functional".
but even clojure itself does not recommend using non-named functions
recursive, but isn't operating on functions themselves the real power of
functional programming?
clojure is popular, and handy, but I feel a large part of that comes from
the easiness of kind of using java as a scripting language , so that u don't
need to go through the compile/build/run cycle, and the iteration is much
faster, kind of like for prototyping purposes. the only real difference of
clojure to java, I feel, is the annoying prefix notation, which is
completely useless, and the syntax could have been completely re-designed to
be like most languages to give users a more natural, intuitive feeling.
The prefix notation and endless "()" is just an archaic legacy left over
from when LISP was created.
相关主题
我对为什么使用FP的理解 (补)1st class citizen
模板算是纯FP吗我还是认为scala的程序员水平高
批判 goclojure这语言真不错
进入Programming版参与讨论
d**********x
发帖数: 4083
211
铜球fp达人来解释

【在 c******n 的大作中提到】
: I don't really see the point of using functional programming languages for
: real production projects, though clojure is very popular now.
: my point is that in a few cases you do need to operate on functions, all
: languages have such features: C has function pointers, java has anonymous
: inner classes, python has lambda. it's just that they do not openly
: advertise them as "functional".
: but even clojure itself does not recommend using non-named functions
: recursive, but isn't operating on functions themselves the real power of
: functional programming?
: clojure is popular, and handy, but I feel a large part of that comes from

p*****2
发帖数: 21240
212
FP这几年越来越流行不就是主要因为parallelism 和 concurrency吗? 传统的
imperative programming不适合做并行计算。
n******t
发帖数: 4406
213
我认为fp比impertive language来说和当前实际计算机差得更远。
和一般人的思维也不那么接近,但是比较接近数学的思维。
所以相应的结果就是两个,第一效率不会很高,第二比较expressive。
最近的机器越来越快,所以fp开始流行起来了。

【在 p*****2 的大作中提到】
: FP这几年越来越流行不就是主要因为parallelism 和 concurrency吗? 传统的
: imperative programming不适合做并行计算。

p*****2
发帖数: 21240
214

基本这么回事。但是貌似不是机器越来越快造成的吧?机器越来越快已经持续很多年了
。相反是因为机器不能越来越快了,因此现在的趋势是core越来越多,所以fp流行起来
了。

【在 n******t 的大作中提到】
: 我认为fp比impertive language来说和当前实际计算机差得更远。
: 和一般人的思维也不那么接近,但是比较接近数学的思维。
: 所以相应的结果就是两个,第一效率不会很高,第二比较expressive。
: 最近的机器越来越快,所以fp开始流行起来了。

x****u
发帖数: 44466
215
core多不会提高fp速度啊。现实点说,不在乎速度的场合才能用FP。

【在 p*****2 的大作中提到】
:
: 基本这么回事。但是貌似不是机器越来越快造成的吧?机器越来越快已经持续很多年了
: 。相反是因为机器不能越来越快了,因此现在的趋势是core越来越多,所以fp流行起来
: 了。

p*****2
发帖数: 21240
216

core多就需要更好的并行计算了。FP在单线程上确实效率没法跟OO的比,但是多线程具
有先天的优势。这也是为什么随着core越来越多,fp越来越流行的真正原因。

【在 x****u 的大作中提到】
: core多不会提高fp速度啊。现实点说,不在乎速度的场合才能用FP。
x****u
发帖数: 44466
217
FP和并行有什么关系。

【在 p*****2 的大作中提到】
:
: core多就需要更好的并行计算了。FP在单线程上确实效率没法跟OO的比,但是多线程具
: 有先天的优势。这也是为什么随着core越来越多,fp越来越流行的真正原因。

p*****2
发帖数: 21240
218

imperative对并行计算有先天的缺陷呀。这些缺陷FP上都没有呀。如果你这个还有疑问
的话,最好先看看FP的基本概念。

【在 x****u 的大作中提到】
: FP和并行有什么关系。
x****u
发帖数: 44466
219
先天缺陷什么啊,VC都支持lambda了。

【在 p*****2 的大作中提到】
:
: imperative对并行计算有先天的缺陷呀。这些缺陷FP上都没有呀。如果你这个还有疑问
: 的话,最好先看看FP的基本概念。

p*****2
发帖数: 21240
220

这个跟lambda没啥关系。支持lambada的语言多了,有几个敢说自己是FP呢?

【在 x****u 的大作中提到】
: 先天缺陷什么啊,VC都支持lambda了。
相关主题
大牛给讲讲monad吧?OOP里面的Object其实是actor
functional programming 哪本书经典适合入门怎么这里这么多人学python
也谈OOP跟FP之争粉FP的人是因为把电脑想象成图灵机了
进入Programming版参与讨论
n******t
发帖数: 4406
221
每一个core不能变快,但是对于大部分应用还是太快。
所以core多,和处理能力强很多时候是一样的。
此外,大部分fp对list和vector支持比较好,所以对于自然并行化的
问题,比较容易scale.

【在 p*****2 的大作中提到】
:
: 这个跟lambda没啥关系。支持lambada的语言多了,有几个敢说自己是FP呢?

p*****2
发帖数: 21240
222

core多也需要application的优化才能转化为更好的性能。即使在OS的level也需要支持
multi core,不然也获得不了应有的benefit。OS支持了,你可以认为处理能力更强了
。但是那是从OS的角度来说的。从application角度也需要支持multi core,否则这个
application就没有take multi core的benefit。而FP正是从application level来讲的
。显然FP做不了底层。

【在 n******t 的大作中提到】
: 每一个core不能变快,但是对于大部分应用还是太快。
: 所以core多,和处理能力强很多时候是一样的。
: 此外,大部分fp对list和vector支持比较好,所以对于自然并行化的
: 问题,比较容易scale.

p*****2
发帖数: 21240
223

关键不是对list vector支持好。

【在 n******t 的大作中提到】
: 每一个core不能变快,但是对于大部分应用还是太快。
: 所以core多,和处理能力强很多时候是一样的。
: 此外,大部分fp对list和vector支持比较好,所以对于自然并行化的
: 问题,比较容易scale.

n******t
发帖数: 4406
224
fp常常是用来计算已经被分拆之后的task,也就是一个core上跑的任务。

【在 p*****2 的大作中提到】
:
: 关键不是对list vector支持好。

p*****2
发帖数: 21240
225

拆分之后为什么只在一个core上跑?

【在 n******t 的大作中提到】
: fp常常是用来计算已经被分拆之后的task,也就是一个core上跑的任务。
x****u
发帖数: 44466
226
VC支持lambda是为了应对多核,和FP没关系。

【在 p*****2 的大作中提到】
:
: 拆分之后为什么只在一个core上跑?

x****u
发帖数: 44466
227
不说别的,OS启动这一块的支持就不好。

【在 n******t 的大作中提到】
: 每一个core不能变快,但是对于大部分应用还是太快。
: 所以core多,和处理能力强很多时候是一样的。
: 此外,大部分fp对list和vector支持比较好,所以对于自然并行化的
: 问题,比较容易scale.

t****a
发帖数: 1212
228
I don't really see the point of using functional programming languages for
real production projects, though clojure is very popular now.
好问题,但也许你尝试用FP语言做一做事情,亲身体验一下,会有不同的感觉。
my point is that in a few cases you do need to operate on functions, all
languages have such features: C has function pointers, java has anonymous
inner classes, python has lambda. it's just that they do not openly
advertise them as "functional".
FP和上述冯诺依曼机式语言有好些地方不一样。最主要之一是immutable的数据结构。
个人的体会是它使得写程序减少了变量,强迫程序员用类似数学推理的方式写程序,提
高了程序的正确性。
在写Clojure程序的时候,我的体会是应该考虑“是什么”,而不是“怎么做”,这点
和冯诺依曼机式语言明显不同。
but even clojure itself does not recommend using non-named functions
recursive, but isn't operating on functions themselves the real power of
functional programming?
真的吗?我没看到这个recommend,能给个出处好么?我通常用anonymous function和
map函数配合,譬如(map #(+ x 2) (list 1 2 3)),如果有其他推荐的方法,请教教我。
clojure is popular, and handy, but I feel a large part of that comes from
the easiness of kind of using java as a scripting language , so that u don't
need to go through the compile/build/run cycle, and the iteration is much
faster, kind of like for prototyping purposes. the only real difference of
clojure to java, I feel, is the annoying prefix notation, which is
completely useless, and the syntax could have been completely re-designed to
be like most languages to give users a more natural, intuitive feeling.
The prefix notation and endless "()" is just an archaic legacy left over
from when LISP was created.
JVM的scripting language由来已久。如果你喜欢偏java格式的语法,可以尝试
beanshell, groovy。你也有其他选择比如Jython, JRuby。
简单就是美。Prefix notation使得Lisp/Clojure用统一的格式,不受语法的限制,个
人以为这正是它美的地方。而且,如果没有了Prefix notation,还如何能使用macro,
operate code as data呢?
刚接触Lisp的同学可能会有些排斥lisp古怪的括号。当你习惯了它的时候,你会喜欢上
它的。
心得:
1. 你需要一个好的编辑器,推荐emacs。NREPL,或者slime+swank-clojure让我感觉超
越了python, R的交互环境,也许你也会这么觉得。
2. 手工配对括号是很麻烦的事情,需要自动配对工具。在emacs下推荐paredit +
rainbow-delimiter。
b*****n
发帖数: 482
229
scala 中一个 par 指令就可以做并行运算了。

【在 n******t 的大作中提到】
: fp常常是用来计算已经被分拆之后的task,也就是一个core上跑的任务。
x****u
发帖数: 44466
230
FP除了效率不行外,没有任何缺点。

【在 t****a 的大作中提到】
: I don't really see the point of using functional programming languages for
: real production projects, though clojure is very popular now.
: 好问题,但也许你尝试用FP语言做一做事情,亲身体验一下,会有不同的感觉。
: my point is that in a few cases you do need to operate on functions, all
: languages have such features: C has function pointers, java has anonymous
: inner classes, python has lambda. it's just that they do not openly
: advertise them as "functional".
: FP和上述冯诺依曼机式语言有好些地方不一样。最主要之一是immutable的数据结构。
: 个人的体会是它使得写程序减少了变量,强迫程序员用类似数学推理的方式写程序,提
: 高了程序的正确性。

相关主题
学FP不是为了写代码, 而是为了优秀的架构.FP更接近人的思维
go几天的一些感受有没有喜欢haskell的同学
Haskell很难学。。对 (im)mutability 的误解和深度理解
进入Programming版参与讨论
p*****2
发帖数: 21240
231

大牛终于出现了。

【在 t****a 的大作中提到】
: I don't really see the point of using functional programming languages for
: real production projects, though clojure is very popular now.
: 好问题,但也许你尝试用FP语言做一做事情,亲身体验一下,会有不同的感觉。
: my point is that in a few cases you do need to operate on functions, all
: languages have such features: C has function pointers, java has anonymous
: inner classes, python has lambda. it's just that they do not openly
: advertise them as "functional".
: FP和上述冯诺依曼机式语言有好些地方不一样。最主要之一是immutable的数据结构。
: 个人的体会是它使得写程序减少了变量,强迫程序员用类似数学推理的方式写程序,提
: 高了程序的正确性。

p*****2
发帖数: 21240
232

这个不是这样子的吧?lambda本来就是fp的东西吧?怎么能说没关系呢?

【在 x****u 的大作中提到】
: VC支持lambda是为了应对多核,和FP没关系。
p*****2
发帖数: 21240
233

这个不一定吧?
FP效率不高并不是绝对的,而且在并行计算有先天的优势。效率应该比imperative的更
高才对。
FP的缺点其实也不少,不然OO早被干掉了。

【在 x****u 的大作中提到】
: FP除了效率不行外,没有任何缺点。
x****u
发帖数: 44466
234
匿名函数和fp没什么必然联系。

【在 p*****2 的大作中提到】
:
: 这个不一定吧?
: FP效率不高并不是绝对的,而且在并行计算有先天的优势。效率应该比imperative的更
: 高才对。
: FP的缺点其实也不少,不然OO早被干掉了。

x****u
发帖数: 44466
235
就算是并行,分到每个核上面还是冯诺依曼架构。

【在 p*****2 的大作中提到】
:
: 这个不一定吧?
: FP效率不高并不是绝对的,而且在并行计算有先天的优势。效率应该比imperative的更
: 高才对。
: FP的缺点其实也不少,不然OO早被干掉了。

p*****2
发帖数: 21240
236

这个有什么根据吗?

【在 x****u 的大作中提到】
: 匿名函数和fp没什么必然联系。
p*****2
发帖数: 21240
237

但是并行以后性能可以提升呀。所以不是FP就性能一定差呀。

【在 x****u 的大作中提到】
: 就算是并行,分到每个核上面还是冯诺依曼架构。
x****u
发帖数: 44466
238
FP的问题是计算量越大,CPU越不是图灵机。

【在 p*****2 的大作中提到】
:
: 但是并行以后性能可以提升呀。所以不是FP就性能一定差呀。

p*****2
发帖数: 21240
239

这是刚从wiki上查的
First class functions have slowly been added to mainstream languages. For
example, in early 1994, support for lambda, filter, map, and reduce was
added to Python. Then during the development of Python 3000, Guido van
Rossum called for the removal of these features.[40][41] So far, only the
reduce function has been removed, but remains accessible via the functools
standard library module.[42] First class functions were also introduced in
PHP 5.3, Visual Basic 9, C# 3.0, and C++11.
The Language Integrated Query (LINQ) feature, with its many incarnations, is
an obvious and powerful use of functional programming in .NET.

【在 x****u 的大作中提到】
: 匿名函数和fp没什么必然联系。
p*****2
发帖数: 21240
240

太高深了。不明白。跟我们讨论的并行有什么关系吗?

【在 x****u 的大作中提到】
: FP的问题是计算量越大,CPU越不是图灵机。
相关主题
对 (im)mutability 的误解和深度理解模板算是纯FP吗
王垠新文 为Java说句公道话批判 go
我对为什么使用FP的理解 (补)1st class citizen
进入Programming版参与讨论
x****u
发帖数: 44466
241
这是什么乱七八糟的。JavaScript也支持匿名函数,莫非JS也是FP?

is

【在 p*****2 的大作中提到】
:
: 太高深了。不明白。跟我们讨论的并行有什么关系吗?

x****u
发帖数: 44466
242
就是说FP在极端条件下不好用,因为整个架构就不是为它设计的。你要是用过以前的计
算机就明白了。

【在 p*****2 的大作中提到】
:
: 太高深了。不明白。跟我们讨论的并行有什么关系吗?

p*****2
发帖数: 21240
243

好了。终于明白你的逻辑了。I服了Y。

【在 x****u 的大作中提到】
: 这是什么乱七八糟的。JavaScript也支持匿名函数,莫非JS也是FP?
:
: is

x****u
发帖数: 44466
244
你悲愤也没用。
90年代的C++也支持匿名函数,只要按照COM的Automation规范写即可。

【在 p*****2 的大作中提到】
:
: 好了。终于明白你的逻辑了。I服了Y。

g*****g
发帖数: 34805
245
FP的最大缺点,不是慢,而是太难。太难的语言,想找够人写个大项目都不可能,想找
个有10年经验的来带项目市面上不存在。
不是没有例外呀,Erlang就算一个。但例外终究是例外,不是主流。
x****u
发帖数: 44466
246
就是一个慢。想快的话就不能顺着FP的自然思路写,那就是自己整自己了。

【在 g*****g 的大作中提到】
: FP的最大缺点,不是慢,而是太难。太难的语言,想找够人写个大项目都不可能,想找
: 个有10年经验的来带项目市面上不存在。
: 不是没有例外呀,Erlang就算一个。但例外终究是例外,不是主流。

g*****g
发帖数: 34805
247
Scala的性能接近Java,比Python, Ruby之类的scripting语言快,不能算慢了。

【在 x****u 的大作中提到】
: 就是一个慢。想快的话就不能顺着FP的自然思路写,那就是自己整自己了。
x****u
发帖数: 44466
248
做个大东西,就有差距了。类似的例子任何两个语言都能找出来。

【在 g*****g 的大作中提到】
: Scala的性能接近Java,比Python, Ruby之类的scripting语言快,不能算慢了。
g*****g
发帖数: 34805
249
性能不是唯一重要的东西,特别差别没超过一个数量级的情况下。就如java性能永远比
不上C++,照样在很多领域取代C++没有压力。开发快速,维护容易,永远是最重要的。
FP简洁是做到了,是否快速要看什么领域。

【在 x****u 的大作中提到】
: 做个大东西,就有差距了。类似的例子任何两个语言都能找出来。
x****u
发帖数: 44466
250
所以说JavaScript也能长盛不衰,主要是特定场合有特定用处。

【在 g*****g 的大作中提到】
: 性能不是唯一重要的东西,特别差别没超过一个数量级的情况下。就如java性能永远比
: 不上C++,照样在很多领域取代C++没有压力。开发快速,维护容易,永远是最重要的。
: FP简洁是做到了,是否快速要看什么领域。

相关主题
我还是认为scala的程序员水平高functional programming 哪本书经典适合入门
clojure这语言真不错也谈OOP跟FP之争
大牛给讲讲monad吧?OOP里面的Object其实是actor
进入Programming版参与讨论
t*s
发帖数: 1504
251
最近在学Haskell
看learn yourself a haskell七八章了。到现在为止没看到Python没有的feature.
Python里面partial, list comprehension, map, reduce, filter都有
什么Eq Ord Show这种Python也有,例如, 一个类如果定义了 __lt__ 等等就能比较
所谓Monad也是故弄玄虚,我专门去看了Philp Wadler (principle designer of
Haskell)的Monads for functional programming。Monad两个字就能解释: annotated
data. 顶多把那三个laws再加上。
Maybe有点意思,但imperative的Exceptional Handling更方便,更有效率。
最不爽的是Haskell readability sucks。
唯一Haskell比Python舒服的地方我觉得是函数定义强制
->a->a->a->b 这个背后的点子非常聪明,非常mathematically beautiful
另外就是匹配中的_符号很符合数学规范。

【在 c******n 的大作中提到】
: I don't really see the point of using functional programming languages for
: real production projects, though clojure is very popular now.
: my point is that in a few cases you do need to operate on functions, all
: languages have such features: C has function pointers, java has anonymous
: inner classes, python has lambda. it's just that they do not openly
: advertise them as "functional".
: but even clojure itself does not recommend using non-named functions
: recursive, but isn't operating on functions themselves the real power of
: functional programming?
: clojure is popular, and handy, but I feel a large part of that comes from

s***o
发帖数: 2191
252
刚跟stackoverflow上的“专家”交流了一下关于Java8跟Scala,专家坚持认为java is
slow, slow, slow...
"chat with an expert" 是stackoverflow 今天推出来的一个新服务,有兴趣的可以去
试一试

【在 g*****g 的大作中提到】
: Scala的性能接近Java,比Python, Ruby之类的scripting语言快,不能算慢了。
E*****m
发帖数: 25615
253

行行行! 你回去拜耶穌比你講你不懂的圖靈機實際點。

【在 x****u 的大作中提到】
: FP的问题是计算量越大,CPU越不是图灵机。
E*****m
发帖数: 25615
254
Abstract data type, pattern matching, guard, laziness...
你用 Python 做這些看看。

annotated

【在 t*s 的大作中提到】
: 最近在学Haskell
: 看learn yourself a haskell七八章了。到现在为止没看到Python没有的feature.
: Python里面partial, list comprehension, map, reduce, filter都有
: 什么Eq Ord Show这种Python也有,例如, 一个类如果定义了 __lt__ 等等就能比较
: 所谓Monad也是故弄玄虚,我专门去看了Philp Wadler (principle designer of
: Haskell)的Monads for functional programming。Monad两个字就能解释: annotated
: data. 顶多把那三个laws再加上。
: Maybe有点意思,但imperative的Exceptional Handling更方便,更有效率。
: 最不爽的是Haskell readability sucks。
: 唯一Haskell比Python舒服的地方我觉得是函数定义强制

d****i
发帖数: 4809
255
OpenMP不就是为了多核并行计算提出来的吗?

【在 p*****2 的大作中提到】
: FP这几年越来越流行不就是主要因为parallelism 和 concurrency吗? 传统的
: imperative programming不适合做并行计算。

E*****m
发帖数: 25615
256

沒哪個語言不能做並行,好不好做的差別而已。

【在 d****i 的大作中提到】
: OpenMP不就是为了多核并行计算提出来的吗?
e*******o
发帖数: 4654
257
直接从clojure doc 上拿个例子。
(((person :employer) :address) :city)
clojure 提供了个 macro ->
所以可以这样写。
(-> person :employer :address :city)
在别的语言中,大致类似的写法是 person.employer.address.city
你喜欢哪个写法? 这个例子说明什么呢?

【在 t****a 的大作中提到】
: I don't really see the point of using functional programming languages for
: real production projects, though clojure is very popular now.
: 好问题,但也许你尝试用FP语言做一做事情,亲身体验一下,会有不同的感觉。
: my point is that in a few cases you do need to operate on functions, all
: languages have such features: C has function pointers, java has anonymous
: inner classes, python has lambda. it's just that they do not openly
: advertise them as "functional".
: FP和上述冯诺依曼机式语言有好些地方不一样。最主要之一是immutable的数据结构。
: 个人的体会是它使得写程序减少了变量,强迫程序员用类似数学推理的方式写程序,提
: 高了程序的正确性。

t*s
发帖数: 1504
258
python的duck type更general.
pattern matching在imperative语言中根本不是问题。也更灵活。
不光可以pattern matching, 还可以value matching
laziness python也有, generator.
guard是啥不知道

【在 E*****m 的大作中提到】
: Abstract data type, pattern matching, guard, laziness...
: 你用 Python 做這些看看。
:
: annotated

t****a
发帖数: 1212
259
我看到的多数人采用->的写法,它的好处可能有
1. 减少了小括号的数目
这是Clojure比Common Lisp改进的方向。Clojure在语言设计上已经想办法减少()的数
目。
2. 提高可读性。
这种写法有点像OOP语言里访问成员的方式。联想到很多Clojure程序员是从Java语言转
过来的,很多人喜欢这样写也就很自然了。

【在 e*******o 的大作中提到】
: 直接从clojure doc 上拿个例子。
: (((person :employer) :address) :city)
: clojure 提供了个 macro ->
: 所以可以这样写。
: (-> person :employer :address :city)
: 在别的语言中,大致类似的写法是 person.employer.address.city
: 你喜欢哪个写法? 这个例子说明什么呢?

p*****2
发帖数: 21240
260
一个最基本的尾递归就把python秒了吧

annotated

【在 t*s 的大作中提到】
: 最近在学Haskell
: 看learn yourself a haskell七八章了。到现在为止没看到Python没有的feature.
: Python里面partial, list comprehension, map, reduce, filter都有
: 什么Eq Ord Show这种Python也有,例如, 一个类如果定义了 __lt__ 等等就能比较
: 所谓Monad也是故弄玄虚,我专门去看了Philp Wadler (principle designer of
: Haskell)的Monads for functional programming。Monad两个字就能解释: annotated
: data. 顶多把那三个laws再加上。
: Maybe有点意思,但imperative的Exceptional Handling更方便,更有效率。
: 最不爽的是Haskell readability sucks。
: 唯一Haskell比Python舒服的地方我觉得是函数定义强制

相关主题
怎么这里这么多人学pythongo几天的一些感受
粉FP的人是因为把电脑想象成图灵机了Haskell很难学。。
学FP不是为了写代码, 而是为了优秀的架构.FP更接近人的思维
进入Programming版参与讨论
E*****m
发帖数: 25615
261

這怎麼來的?
你到底讀了那本書沒有? 我覺得你沒有。
我說的 pattern matching 是這種
sum [] = 0
sum x:xs = x + sum xs
python 的太有限, 你看看這個經典算 Fibonacci series 的
fibs :: [Integer]
fibs = 1:1:zipwith (+) fibs (tail fibs)
python 做不到這麼精簡的
Learn You a Haskell for Great Good! 第四章
我不是Python 黑,事實上我是Python 粉, 不過各有
長處罷了。

【在 t*s 的大作中提到】
: python的duck type更general.
: pattern matching在imperative语言中根本不是问题。也更灵活。
: 不光可以pattern matching, 还可以value matching
: laziness python也有, generator.
: guard是啥不知道

A*******t
发帖数: 443
262
您学过theory of computation或者mathematical logic吗?

【在 x****u 的大作中提到】
: FP的问题是计算量越大,CPU越不是图灵机。
A*******t
发帖数: 443
263
求问GADT, template Haskell, type based reflection, quasiquoting 在python里面
是咋做的。

【在 t*s 的大作中提到】
: python的duck type更general.
: pattern matching在imperative语言中根本不是问题。也更灵活。
: 不光可以pattern matching, 还可以value matching
: laziness python也有, generator.
: guard是啥不知道

E*****m
发帖数: 25615
264

他上次已經發貼曝露他沒搞懂啥教 Turing Machine 了。

【在 A*******t 的大作中提到】
: 您学过theory of computation或者mathematical logic吗?
L***n
发帖数: 6727
265
那位就是灌水扯淡的

【在 E*****m 的大作中提到】
:
: 他上次已經發貼曝露他沒搞懂啥教 Turing Machine 了。

E*****m
发帖数: 25615
266
他是信耶穌的, 凡事講信仰,不講證據。

【在 L***n 的大作中提到】
: 那位就是灌水扯淡的
t*s
发帖数: 1504
267
google了一下
这个是haskell编译懂得优化,还是需要人为的写,例如用fold?
如果是用fold, python也有,但只是从左到右
要reverse效率会下降。

【在 p*****2 的大作中提到】
: 一个最基本的尾递归就把python秒了吧
:
: annotated

t*s
发帖数: 1504
268
一个都没听说过

【在 A*******t 的大作中提到】
: 求问GADT, template Haskell, type based reflection, quasiquoting 在python里面
: 是咋做的。

e*******o
发帖数: 4654
269
我开始看的时候也没懂pattern matching。
-----------
我也秀几个fibs,从长到短。
@fibs1 := 1, 1, -> $a, $b { $a + $b } ... * ;
@fibs2 := 1, 1, {$^a + $^b } ... * ;
@fibs3 := 1, 1, * + * ... * ;
@fibs4 := 1, 1, &[+] ... * ;
这就是臭名昭著的perl6。
perl6 也支持pattern matching的。

【在 E*****m 的大作中提到】
: 他是信耶穌的, 凡事講信仰,不講證據。
t*s
发帖数: 1504
270
sum [] = 0
sum x:xs = x + sum xs
我说的就是这种,这类型的在python/c/java里面就是if if 的事情
if 还不光看pattern, value也能一并看了。
fibs :: [Integer]
fibs = 1:1:zipwith (+) fibs (tail fibs)
python里面yield from, yield来构建generator也很方便,例如
def fibs():
a,b=1,1
yield from (a,b)
while True:
a,b=b,a+b
yield b
guard我去看了一下,这也叫feature? 难怪我不记得。就是switch case case

【在 E*****m 的大作中提到】
: 他是信耶穌的, 凡事講信仰,不講證據。
相关主题
FP更接近人的思维王垠新文 为Java说句公道话
有没有喜欢haskell的同学我对为什么使用FP的理解 (补)
对 (im)mutability 的误解和深度理解模板算是纯FP吗
进入Programming版参与讨论
g****r
发帖数: 1589
271
Functional Language都出来40年了,很多概念模式被其他语言也吸收了不少,比如JS
和C#里就有大量Functional的feature和用法,估计Python里应该也有不少吧
imperative语言的特点就是你告诉计算机怎么去做一件事,if..else就是告诉计算机先
比较这俩数,如果true就干这个事;functional的特点就是只告诉计算机要完成的任务
是啥,pattern matching就是定义一个函数,然后计算机来帮你分析执行;我感觉
functional的写法还是更high level、更简洁一点,当然区别可能也没那么大,所以很
多人觉得这是脱裤子放屁
要说实现都能实现,有啥不能实现的,用汇编也就是几个CMP,JNE
说来也就是你喜欢那种,那个效率高,对于某些特定的问题哪个更有优势。通用语言肯
定还是用得最广的,但通用语言也是不断的在加入Functional Programming的概念,以
后我觉得也是multi paradigm语言的有点前途,比如F#和Scala这种,纯粹的
Functional Language比如haskell,我觉得很难在工业界流行开来,当然作为业余爱好
,搞点小东西,作为学习研究对象还是有价值的

【在 t*s 的大作中提到】
: sum [] = 0
: sum x:xs = x + sum xs
: 我说的就是这种,这类型的在python/c/java里面就是if if 的事情
: if 还不光看pattern, value也能一并看了。
: fibs :: [Integer]
: fibs = 1:1:zipwith (+) fibs (tail fibs)
: python里面yield from, yield来构建generator也很方便,例如
: def fibs():
: a,b=1,1
: yield from (a,b)

E*****m
发帖数: 25615
272

沒什麼是 Python (或任何 TM-complete 語言) 一定做不到的,差別
就是簡潔易懂否, 你那個 fibs 例子就長了幾倍,不是嗎?
還有個 laziness 的例子 python 更難做的, 用 sieve 來求質數
primesT = sieve [2..] where
sieve (p:xs) = p : sieve [x | x <- xs, rem x p /= 0]
然後求前 100 個質數就是
take 100 primesT
當然, 我不否認不是所有東西都需要 laziness,只是有時 laziness
會讓題目比較好解。

【在 t*s 的大作中提到】
: sum [] = 0
: sum x:xs = x + sum xs
: 我说的就是这种,这类型的在python/c/java里面就是if if 的事情
: if 还不光看pattern, value也能一并看了。
: fibs :: [Integer]
: fibs = 1:1:zipwith (+) fibs (tail fibs)
: python里面yield from, yield来构建generator也很方便,例如
: def fibs():
: a,b=1,1
: yield from (a,b)

w****w
发帖数: 521
273
给个简单例子:
20年前,你写了个复杂的SQL query,在当时的sql server上要运行2个月。现在同样的
query用不同的硬件和database engine,两秒钟就出来了。FP只告诉计算机要什么,至
于怎么做就不管了。系统软件硬件发展越快,FP的优势就会越来越明显。
p*****2
发帖数: 21240
274

JS
大牛说的很好。

【在 g****r 的大作中提到】
: Functional Language都出来40年了,很多概念模式被其他语言也吸收了不少,比如JS
: 和C#里就有大量Functional的feature和用法,估计Python里应该也有不少吧
: imperative语言的特点就是你告诉计算机怎么去做一件事,if..else就是告诉计算机先
: 比较这俩数,如果true就干这个事;functional的特点就是只告诉计算机要完成的任务
: 是啥,pattern matching就是定义一个函数,然后计算机来帮你分析执行;我感觉
: functional的写法还是更high level、更简洁一点,当然区别可能也没那么大,所以很
: 多人觉得这是脱裤子放屁
: 要说实现都能实现,有啥不能实现的,用汇编也就是几个CMP,JNE
: 说来也就是你喜欢那种,那个效率高,对于某些特定的问题哪个更有优势。通用语言肯
: 定还是用得最广的,但通用语言也是不断的在加入Functional Programming的概念,以

l*********s
发帖数: 5409
275
enlightening

JS

【在 g****r 的大作中提到】
: Functional Language都出来40年了,很多概念模式被其他语言也吸收了不少,比如JS
: 和C#里就有大量Functional的feature和用法,估计Python里应该也有不少吧
: imperative语言的特点就是你告诉计算机怎么去做一件事,if..else就是告诉计算机先
: 比较这俩数,如果true就干这个事;functional的特点就是只告诉计算机要完成的任务
: 是啥,pattern matching就是定义一个函数,然后计算机来帮你分析执行;我感觉
: functional的写法还是更high level、更简洁一点,当然区别可能也没那么大,所以很
: 多人觉得这是脱裤子放屁
: 要说实现都能实现,有啥不能实现的,用汇编也就是几个CMP,JNE
: 说来也就是你喜欢那种,那个效率高,对于某些特定的问题哪个更有优势。通用语言肯
: 定还是用得最广的,但通用语言也是不断的在加入Functional Programming的概念,以

c******n
发帖数: 4965
276
I think a big problem with the FP camp is that they keep peddling the old
stuff, which, as you said, may be brilliant in the 60's, but are so common
today that the listener find it hard to understand why the FP enthusiasts
say it's a big deal.
FP camp should look at the world today and sell the true deltas above other
languages.

JS

【在 g****r 的大作中提到】
: Functional Language都出来40年了,很多概念模式被其他语言也吸收了不少,比如JS
: 和C#里就有大量Functional的feature和用法,估计Python里应该也有不少吧
: imperative语言的特点就是你告诉计算机怎么去做一件事,if..else就是告诉计算机先
: 比较这俩数,如果true就干这个事;functional的特点就是只告诉计算机要完成的任务
: 是啥,pattern matching就是定义一个函数,然后计算机来帮你分析执行;我感觉
: functional的写法还是更high level、更简洁一点,当然区别可能也没那么大,所以很
: 多人觉得这是脱裤子放屁
: 要说实现都能实现,有啥不能实现的,用汇编也就是几个CMP,JNE
: 说来也就是你喜欢那种,那个效率高,对于某些特定的问题哪个更有优势。通用语言肯
: 定还是用得最广的,但通用语言也是不断的在加入Functional Programming的概念,以

t****a
发帖数: 1212
277
你能否说具体一点?比如哪些是old stuff,brilliant in the 60's但是今天so
common?如果你说的是你原文中给出的那些材料,那么这些回帖里面已经说的很清楚了
:今天的language并没有完全实现那些feature。
另外,FP中有趣的概念很多,不仅仅是你的帖子中说到的那些。

other

【在 c******n 的大作中提到】
: I think a big problem with the FP camp is that they keep peddling the old
: stuff, which, as you said, may be brilliant in the 60's, but are so common
: today that the listener find it hard to understand why the FP enthusiasts
: say it's a big deal.
: FP camp should look at the world today and sell the true deltas above other
: languages.
:
: JS

t****a
发帖数: 1212
278
市场上可用的语言越来越多是不争的事实。通用语言可以保证容易找到饭碗,专用语言
在专有领域具有优势。
另外FP和Imperative语言的差别..个人觉得还是蛮大的,最主要的是会改变程序员思考
问题的方式。
如果哪个程序员说他很随意的在纯FP语言和纯Imperative语言之间转换思维,从而总是
能在合适的地方用最适合的方式,那倒真是令人佩服。

JS

【在 g****r 的大作中提到】
: Functional Language都出来40年了,很多概念模式被其他语言也吸收了不少,比如JS
: 和C#里就有大量Functional的feature和用法,估计Python里应该也有不少吧
: imperative语言的特点就是你告诉计算机怎么去做一件事,if..else就是告诉计算机先
: 比较这俩数,如果true就干这个事;functional的特点就是只告诉计算机要完成的任务
: 是啥,pattern matching就是定义一个函数,然后计算机来帮你分析执行;我感觉
: functional的写法还是更high level、更简洁一点,当然区别可能也没那么大,所以很
: 多人觉得这是脱裤子放屁
: 要说实现都能实现,有啥不能实现的,用汇编也就是几个CMP,JNE
: 说来也就是你喜欢那种,那个效率高,对于某些特定的问题哪个更有优势。通用语言肯
: 定还是用得最广的,但通用语言也是不断的在加入Functional Programming的概念,以

g*****g
发帖数: 34805
279
说Java慢看跟什么比,跟C比自然是慢的。我见过的benchmark,都比Scala快一点。

is

【在 s***o 的大作中提到】
: 刚跟stackoverflow上的“专家”交流了一下关于Java8跟Scala,专家坚持认为java is
: slow, slow, slow...
: "chat with an expert" 是stackoverflow 今天推出来的一个新服务,有兴趣的可以去
: 试一试

s***o
发帖数: 2191
280
that's a stackoverflow "new feature" available on April 1 :)
不过我的确是去看java 8对scala能造成啥影响的话题的。好虫说一下,scala还有没有
成为主流的可能,或者一直这么不温不火下去?

【在 g*****g 的大作中提到】
: 说Java慢看跟什么比,跟C比自然是慢的。我见过的benchmark,都比Scala快一点。
:
: is

相关主题
批判 goclojure这语言真不错
1st class citizen大牛给讲讲monad吧?
我还是认为scala的程序员水平高functional programming 哪本书经典适合入门
进入Programming版参与讨论
x****u
发帖数: 44466
281
你这就不是扯淡,是发paper。

【在 L***n 的大作中提到】
: 那位就是灌水扯淡的
a*****e
发帖数: 1700
282
你有这样的感觉没错,Python 的这些概念都来源于 FP,事实上,从 Lisp 引入 GC 开
始,非常多的 FP 的特征,已经越来越普遍地进入到其它非 FP 的语言。
我想你要问的是,既然这样,为什么要学习 Haskell 或者 FP?
我给几个 Haskell 有,但是你在 python 里面学不到的东西吧:
1. Strong type system
duck typing 看似更灵活,但是实际上它只是一个 sum of all types,没办法保证
type safty。有时候更 general 不是好事情,反而是有限制,尤其是编译器能够通过
静态检查就能确保程序遵守了这些限制,更有益处。举个例子,很多语言都有 SQL 的
库可用,但有几个能够静态检查,确保所有发出的 SQL 查询都是合法的?再比如,一
个程序需要处理平衡二叉树,你能够通过静态检查就确保不会发生不平衡的情况出现吗
?这些只有强类型的 abstract datatype 才能做到。
如果你要进一步学习 type system,那么 LYAH 这本书是不够的,需要看一些程序语言
的教科书。
2. Monad
首先,这个概念本身是超出计算机语言的,无论你用那种方式写程序,只要有满足
monad 的结构,它就在那里,无非是作为一个程序员,你是否意识到了,意识到之后是
否能够利用 monad 的特征来完成想要完成的任务。
Monad 最先用于编程就是在 Haskell 里,这不是一个巧合。只有 Haskell 如此偏执地
追求无副作用操作,才有 Monad,以及更多 category 理论概念存在的土壤。
到底 Monad 有什么用?我举个例子。如果你学习一下 CPS Monad,然后实现一个 co-
routine 到 event loop 的变换,就能够了解由 Node.js 引发的 async 编程潮流,只
是一个浮夸的假象。在 Haskell 里面,根本无需语言本身支持,直接能够写出 co-
routine 程序,以 async 方式执行。
3. Fusion
这个牵涉到编译器的技术,可能不是所有人感兴趣。不过那些认为高级语言,或者是抽
象层高的编程方式,肯定是没有效率的说法,可以休矣。
举个我今天遇到的例子,一个 image convolution 的 Haskell 程序,居然把 memory
bandwidth 耗尽,比 C 程序快了近十倍,然后 4 thread 和 1 thread 执行起来时间
是一样的,完全没有道理,让我同事很伤脑筋。后来经过分析机器码发现,是因为源程
序里用来测试的 image 也是写在程序里通过一个函数生成的,编译器居然把所有的计
算(从 src image 读入数据,计算,写入 dst image)化简为直接向 dst image 写入
constant。
虽然是个极端的例子,但是这种对源程序进行推理,利用代数性质做等效变换,最后能
够生成非常高效代码的方式,只有在纯 FP 语言里才有可能做到。
当然反过来说,认为 FP 的效率已经比 C 好了,也是没有什么道理的。但一个不争的
事实是,符合高层次逻辑的程序更容易写,更容易维护,而另一方面 CPU 的发展导致
只有紧贴机器层面才能够高效发挥硬件潜力。这两者之间的 gap 越来越大,而 FP 的
理论可以把人从 SIMD/Cache Miss/Multi-Core 等等调优的繁琐过程中解放出来,从而
维持原代码的模块和逻辑清晰。
4. DSL
这个是我喜欢 Haskell 的主要原因。没有任何一个语言能够像 Haskell 这样灵活
地实现 DSL/eDSL,对程序做分析,重组,解释甚至和元语言一块儿编译执行。因为
DSL 本身是直接以 combinator 或者 monad 方式写在 Haskell 程序里面的,
无须另外做 lexer/parser,连类型检查都是免费得来。
Haskell 的类型系统在这里帮了很多忙,它的 type class 让很多繁复的 AST
操作变得非常模块化,对副作用的严格控制也让 DSL 更加安全可靠。所以
Simon PJ 说 Haskell is the best imperative programming language
不是没有道理的。

annotated

【在 t*s 的大作中提到】
: 最近在学Haskell
: 看learn yourself a haskell七八章了。到现在为止没看到Python没有的feature.
: Python里面partial, list comprehension, map, reduce, filter都有
: 什么Eq Ord Show这种Python也有,例如, 一个类如果定义了 __lt__ 等等就能比较
: 所谓Monad也是故弄玄虚,我专门去看了Philp Wadler (principle designer of
: Haskell)的Monads for functional programming。Monad两个字就能解释: annotated
: data. 顶多把那三个laws再加上。
: Maybe有点意思,但imperative的Exceptional Handling更方便,更有效率。
: 最不爽的是Haskell readability sucks。
: 唯一Haskell比Python舒服的地方我觉得是函数定义强制

r*******n
发帖数: 3020
283
我觉得尾递归还不如上loop。

【在 p*****2 的大作中提到】
: 一个最基本的尾递归就把python秒了吧
:
: annotated

p*****2
发帖数: 21240
284

一个东西

【在 r*******n 的大作中提到】
: 我觉得尾递归还不如上loop。
f********o
发帖数: 13
285
google trampoline

【在 p*****2 的大作中提到】
:
: 一个东西

n*w
发帖数: 3393
286
这里常有人用“x能做到的y也能做到为自己辩护”。所有图灵完备的语言都可以做到相
同的事情。不同的是语义,表达能力,等方面的差异。

【在 E*****m 的大作中提到】
:
: 沒什麼是 Python (或任何 TM-complete 語言) 一定做不到的,差別
: 就是簡潔易懂否, 你那個 fibs 例子就長了幾倍,不是嗎?
: 還有個 laziness 的例子 python 更難做的, 用 sieve 來求質數
: primesT = sieve [2..] where
: sieve (p:xs) = p : sieve [x | x <- xs, rem x p /= 0]
: 然後求前 100 個質數就是
: take 100 primesT
: 當然, 我不否認不是所有東西都需要 laziness,只是有時 laziness
: 會讓題目比較好解。

g*****g
发帖数: 34805
287
看你怎么定义主流,到今天ruby的流行程度是很有可能的,超越java是没有可能的。

【在 s***o 的大作中提到】
: that's a stackoverflow "new feature" available on April 1 :)
: 不过我的确是去看java 8对scala能造成啥影响的话题的。好虫说一下,scala还有没有
: 成为主流的可能,或者一直这么不温不火下去?

x****o
发帖数: 21566
288
写的真不错

【在 a*****e 的大作中提到】
: 你有这样的感觉没错,Python 的这些概念都来源于 FP,事实上,从 Lisp 引入 GC 开
: 始,非常多的 FP 的特征,已经越来越普遍地进入到其它非 FP 的语言。
: 我想你要问的是,既然这样,为什么要学习 Haskell 或者 FP?
: 我给几个 Haskell 有,但是你在 python 里面学不到的东西吧:
: 1. Strong type system
: duck typing 看似更灵活,但是实际上它只是一个 sum of all types,没办法保证
: type safty。有时候更 general 不是好事情,反而是有限制,尤其是编译器能够通过
: 静态检查就能确保程序遵守了这些限制,更有益处。举个例子,很多语言都有 SQL 的
: 库可用,但有几个能够静态检查,确保所有发出的 SQL 查询都是合法的?再比如,一
: 个程序需要处理平衡二叉树,你能够通过静态检查就确保不会发生不平衡的情况出现吗

t*s
发帖数: 1504
289
干straw man有意思么?
我的意思就是相对于其他语言(例如Python),Haskell卖点不足, 绝大多数程序员没理
由去学Haskell。
fp的卖点有些什么? pure function, curry, laziness, 常见工具list
comprehension, map, reduce, filter。 这些python都支持。
同时,Haskell有致命的缺点,因为有些算法本身就不适合FP。
遇到适合fp的问题, python程序员也可以写fp风格的code。遇到不适合fp的问题,
Haskell程序员就要头大了。
作为一个Haskell没入门的,我只能说到目前为止, Haskell吸引我的是三点
1 编译语言做科学计算快
2 作为数学出身,Haskell看起来美
3 Haskell的type system很好
Haskell community关键是没有一个好tutorial. 至少我没找到。
learn your a haskell是很烂的tutorial
我review这个tutorial的话我会提如下意见
1. 重点介绍独特的feature, 重点讲motivation
2. remove all unnecessary details, or move ot the reference -- 为什么第二章
就讲一大堆list的库函数?
教c语言的会开篇就把strings.h里面的函数一一列举的么?

【在 n*w 的大作中提到】
: 这里常有人用“x能做到的y也能做到为自己辩护”。所有图灵完备的语言都可以做到相
: 同的事情。不同的是语义,表达能力,等方面的差异。

E*****m
发帖数: 25615
290
我認為 Haskell 的最大賣點應該是不讓你做某些事, 強迫你別弄出
不該有的錯誤。
再說一次, Python 的 laziness 不是同個等級的, 完全不能比。
Haskell 的速度也比 Python 快得多。
Real World Haskell 比 Learn yourself a Haskell 更好點。

【在 t*s 的大作中提到】
: 干straw man有意思么?
: 我的意思就是相对于其他语言(例如Python),Haskell卖点不足, 绝大多数程序员没理
: 由去学Haskell。
: fp的卖点有些什么? pure function, curry, laziness, 常见工具list
: comprehension, map, reduce, filter。 这些python都支持。
: 同时,Haskell有致命的缺点,因为有些算法本身就不适合FP。
: 遇到适合fp的问题, python程序员也可以写fp风格的code。遇到不适合fp的问题,
: Haskell程序员就要头大了。
: 作为一个Haskell没入门的,我只能说到目前为止, Haskell吸引我的是三点
: 1 编译语言做科学计算快

相关主题
也谈OOP跟FP之争粉FP的人是因为把电脑想象成图灵机了
OOP里面的Object其实是actor学FP不是为了写代码, 而是为了优秀的架构.
怎么这里这么多人学pythongo几天的一些感受
进入Programming版参与讨论
p*****2
发帖数: 21240
291

Haskell不行,不代表FP不行呀。上边不是已经说了吗,python吸收了大量FP的feature
。FP的很多feature还是很有用的,不然Python吸收干嘛?当然了,我也认为混合型的
语言更现实,比如python,ruby,scala这些。

【在 t*s 的大作中提到】
: 干straw man有意思么?
: 我的意思就是相对于其他语言(例如Python),Haskell卖点不足, 绝大多数程序员没理
: 由去学Haskell。
: fp的卖点有些什么? pure function, curry, laziness, 常见工具list
: comprehension, map, reduce, filter。 这些python都支持。
: 同时,Haskell有致命的缺点,因为有些算法本身就不适合FP。
: 遇到适合fp的问题, python程序员也可以写fp风格的code。遇到不适合fp的问题,
: Haskell程序员就要头大了。
: 作为一个Haskell没入门的,我只能说到目前为止, Haskell吸引我的是三点
: 1 编译语言做科学计算快

L***n
发帖数: 6727
292
做科学计算的用haskell需要很大勇气...

【在 t*s 的大作中提到】
: 干straw man有意思么?
: 我的意思就是相对于其他语言(例如Python),Haskell卖点不足, 绝大多数程序员没理
: 由去学Haskell。
: fp的卖点有些什么? pure function, curry, laziness, 常见工具list
: comprehension, map, reduce, filter。 这些python都支持。
: 同时,Haskell有致命的缺点,因为有些算法本身就不适合FP。
: 遇到适合fp的问题, python程序员也可以写fp风格的code。遇到不适合fp的问题,
: Haskell程序员就要头大了。
: 作为一个Haskell没入门的,我只能说到目前为止, Haskell吸引我的是三点
: 1 编译语言做科学计算快

E*****m
发帖数: 25615
293

除了做練習以外, 用 Haskell 都需要勇氣。

【在 L***n 的大作中提到】
: 做科学计算的用haskell需要很大勇气...
m*********t
发帖数: 527
294
我怎么听起来觉得你在举反例呢。。。。这个 case 里面编译器干的是多余(可能不安
全)的事情吧。
“编译器居然把所有的计
算(从 src image 读入数据,计算,写入 dst image)化简为直接向 dst image 写入
constant。

最终程序得到想要的结果呢还是不是?你觉得这个是好事?

3. Fusion
这个牵涉到编译器的技术,可能不是所有人感兴趣。不过那些认为高级语言,或者是抽
象层高的编程方式,肯定是没有效率的说法,可以休矣。
举个我今天遇到的例子,一个 image convolution 的 Haskell 程序,居然把 memory
bandwidth 耗尽,比 C 程序快了近十倍,然后 4 thread 和 1 thread 执行起来时间
是一样的,完全没有道理,让我同事很伤脑筋。后来经过分析机器码发现,是因为源程
序里用来测试的 image 也是写在程序里通过一个函数生成的,编译器居然把所有的计
算(从 src image 读入数据,计算,写入 dst image)化简为直接向 dst image 写入
constant。
虽然是个极端的例子,但是这种对源程序进行推理,利用代数性质做等效变换,最后能
够生成非常高效代码的方式,只有在纯 FP 语言里才有可能做到。
当然反过来说,认为 FP 的效率已经比 C 好了,也是没有什么道理的。但一个不争的
事实是,符合高层次逻辑的程序更容易写,更容易维护,而另一方面 CPU 的发展导致
只有紧贴机器层面才能够高效发挥硬件潜力。这两者之间的 gap 越来越大,而 FP 的
理论可以把人从 SIMD/Cache Miss/Multi-Core 等等调优的繁琐过程中解放出来,从而
维持原代码的模块和逻辑清晰。

【在 a*****e 的大作中提到】
: 你有这样的感觉没错,Python 的这些概念都来源于 FP,事实上,从 Lisp 引入 GC 开
: 始,非常多的 FP 的特征,已经越来越普遍地进入到其它非 FP 的语言。
: 我想你要问的是,既然这样,为什么要学习 Haskell 或者 FP?
: 我给几个 Haskell 有,但是你在 python 里面学不到的东西吧:
: 1. Strong type system
: duck typing 看似更灵活,但是实际上它只是一个 sum of all types,没办法保证
: type safty。有时候更 general 不是好事情,反而是有限制,尤其是编译器能够通过
: 静态检查就能确保程序遵守了这些限制,更有益处。举个例子,很多语言都有 SQL 的
: 库可用,但有几个能够静态检查,确保所有发出的 SQL 查询都是合法的?再比如,一
: 个程序需要处理平衡二叉树,你能够通过静态检查就确保不会发生不平衡的情况出现吗

a*****e
发帖数: 1700
295
运行结果完全正确,程序没有任何问题,编译器进行这种程度的优化都是基于数理逻辑
的推断,确保安全。
唯一的问题是运行时间不符合事先的期望,没想到会 saturate memory bandwidth。后
来发现是因为用于测试的 src image 写在了程序里,如果从文件读取,则编译器不会
把这部分也优化掉。

【在 m*********t 的大作中提到】
: 我怎么听起来觉得你在举反例呢。。。。这个 case 里面编译器干的是多余(可能不安
: 全)的事情吧。
: “编译器居然把所有的计
: 算(从 src image 读入数据,计算,写入 dst image)化简为直接向 dst image 写入
: constant。
: ”
: 最终程序得到想要的结果呢还是不是?你觉得这个是好事?
:
: 3. Fusion
: 这个牵涉到编译器的技术,可能不是所有人感兴趣。不过那些认为高级语言,或者是抽

m*********t
发帖数: 527
296
其实你们应该多说说:什么样的问题用 FP 来解决很合适,和 OOP 比较呢?。内核以
及嵌入式? 前端? game?数据分析?复杂的并行和需要大量内存的科学计算? 我看
到一些 haskell 的例子内存占用似乎比 C 要多好几倍(是不是 immutable 的原因?
),这样对于 memory bandwidth limit
的计算程序怎么弄?
还有说说这东西在大规模开发的时候代码可读性和可维护性?

【在 a*****e 的大作中提到】
: 运行结果完全正确,程序没有任何问题,编译器进行这种程度的优化都是基于数理逻辑
: 的推断,确保安全。
: 唯一的问题是运行时间不符合事先的期望,没想到会 saturate memory bandwidth。后
: 来发现是因为用于测试的 src image 写在了程序里,如果从文件读取,则编译器不会
: 把这部分也优化掉。

g*****g
发帖数: 34805
297
Actor model在Erlang上的使用,是我知道的唯一有说服力的例子。Scala火起来同样也
是因为Actor model的实现(Akka)。除此之外,FP基本上都用在语言相关的领域。

【在 m*********t 的大作中提到】
: 其实你们应该多说说:什么样的问题用 FP 来解决很合适,和 OOP 比较呢?。内核以
: 及嵌入式? 前端? game?数据分析?复杂的并行和需要大量内存的科学计算? 我看
: 到一些 haskell 的例子内存占用似乎比 C 要多好几倍(是不是 immutable 的原因?
: ),这样对于 memory bandwidth limit
: 的计算程序怎么弄?
: 还有说说这东西在大规模开发的时候代码可读性和可维护性?

E*****m
发帖数: 25615
298

隨便舉兩個商用例子, ITA 和 Jane Street 都不是處理語言的。

【在 g*****g 的大作中提到】
: Actor model在Erlang上的使用,是我知道的唯一有说服力的例子。Scala火起来同样也
: 是因为Actor model的实现(Akka)。除此之外,FP基本上都用在语言相关的领域。

g*****g
发帖数: 34805
299
They are not exactly industry-leading companies or applications. ITA was
acquired for 700 Million, PCLN is worth 35 Billion. Jane Street has 280
employees. GS has 30K. Just some perspectives to look at.

【在 E*****m 的大作中提到】
:
: 隨便舉兩個商用例子, ITA 和 Jane Street 都不是處理語言的。

E*****m
发帖数: 25615
300

You forgot what you claimed?
So, which industry leader use FP for language?
I never said FP is already very successful in industry.

【在 g*****g 的大作中提到】
: They are not exactly industry-leading companies or applications. ITA was
: acquired for 700 Million, PCLN is worth 35 Billion. Jane Street has 280
: employees. GS has 30K. Just some perspectives to look at.

相关主题
Haskell很难学。。对 (im)mutability 的误解和深度理解
FP更接近人的思维王垠新文 为Java说句公道话
有没有喜欢haskell的同学我对为什么使用FP的理解 (补)
进入Programming版参与讨论
g*****g
发帖数: 34805
301
Erlang's usage in Ericsson is an industry leading example. It's high
availability is hard to achieve with other languages. I stress industry
leading because that's only way to convince adoption.

【在 E*****m 的大作中提到】
:
: You forgot what you claimed?
: So, which industry leader use FP for language?
: I never said FP is already very successful in industry.

E*****m
发帖数: 25615
302
Obviously, it's not the only way. Otherwise, how did Java come along?

【在 g*****g 的大作中提到】
: Erlang's usage in Ericsson is an industry leading example. It's high
: availability is hard to achieve with other languages. I stress industry
: leading because that's only way to convince adoption.

g*****g
发帖数: 34805
303
So you don't know nothing about history. Java came along as the industry
leading enterprise application language on server side. C++ was the primary
contest at the time, but it's quickly overcame by Java's reliability and
fast time-to-market.

【在 E*****m 的大作中提到】
: Obviously, it's not the only way. Otherwise, how did Java come along?
E*****m
发帖数: 25615
304

primary
I started programming Java sometime in '96 or so. I know it quite well.
And you forgot your claim again. What convinced the first industry leader
to use Java?

【在 g*****g 的大作中提到】
: So you don't know nothing about history. Java came along as the industry
: leading enterprise application language on server side. C++ was the primary
: contest at the time, but it's quickly overcame by Java's reliability and
: fast time-to-market.

g*****g
发帖数: 34805
305
Everything starts as an experiment. But it didn't take long before Java
dominated in the enterprise market. Java was released in 1995. J2EE 1.2 spec
was out in 1999 and I used that for websites in 2000. Your hello world
experience in school doesn't count.
In comparison, which FP today is a Spring chicken?

【在 E*****m 的大作中提到】
:
: primary
: I started programming Java sometime in '96 or so. I know it quite well.
: And you forgot your claim again. What convinced the first industry leader
: to use Java?

E*****m
发帖数: 25615
306

spec
Thank you for your wrong speculation. I wrote my thesis work in Java, which
is a little bit more than hello world.
So, what convinced the first industry leader to use Java?
I'd say Scala is promising. But I am not a coder, I don't need to bet on it.

【在 g*****g 的大作中提到】
: Everything starts as an experiment. But it didn't take long before Java
: dominated in the enterprise market. Java was released in 1995. J2EE 1.2 spec
: was out in 1999 and I used that for websites in 2000. Your hello world
: experience in school doesn't count.
: In comparison, which FP today is a Spring chicken?

g*****g
发帖数: 34805
307
Your thesis, LOL. Wonder what's the usage of your thesis in industry? Sorry,
does it hurt to talk about reality?
Sun invented Java. Obviously they had interests in Java, much like M$ on .
Net. Sun happened to be an industry leader in enterprise space at that time.
In fact, IBM joined the force in no time and M$ wanted to adopt it too with
their own variation. The rest is history.

which
it.

【在 E*****m 的大作中提到】
:
: spec
: Thank you for your wrong speculation. I wrote my thesis work in Java, which
: is a little bit more than hello world.
: So, what convinced the first industry leader to use Java?
: I'd say Scala is promising. But I am not a coder, I don't need to bet on it.

g*****g
发帖数: 34805
308
I worked on Scala for 2 years, long before you exist here. And I am talking
about industry projects.
Scala got hot due to Akka, which is a good and bad thing. On one hand, it's
promising like how Erlang was proven in telecom industry. On the other hand,
the majority of applications don't need Akka, which makes Scala less
attractive as a general purpose language.

which
it.

【在 E*****m 的大作中提到】
:
: spec
: Thank you for your wrong speculation. I wrote my thesis work in Java, which
: is a little bit more than hello world.
: So, what convinced the first industry leader to use Java?
: I'd say Scala is promising. But I am not a coder, I don't need to bet on it.

E*****m
发帖数: 25615
309

Sorry,
It's funny that you can never remember what we are discussing.
time.
with
So, you are saying it's possible to use a new language when there are no
other
industry leader using it. Right?

【在 g*****g 的大作中提到】
: Your thesis, LOL. Wonder what's the usage of your thesis in industry? Sorry,
: does it hurt to talk about reality?
: Sun invented Java. Obviously they had interests in Java, much like M$ on .
: Net. Sun happened to be an industry leader in enterprise space at that time.
: In fact, IBM joined the force in no time and M$ wanted to adopt it too with
: their own variation. The rest is history.
:
: which
: it.

g*****g
发帖数: 34805
310
You can always use a new or old language in a new or old area. And there's
always a chance of success. It's only that I wouldn't claim their
superiority before their success. Let the reality do the talk, that's my
stance.

【在 E*****m 的大作中提到】
:
: Sorry,
: It's funny that you can never remember what we are discussing.
: time.
: with
: So, you are saying it's possible to use a new language when there are no
: other
: industry leader using it. Right?

相关主题
我对为什么使用FP的理解 (补)1st class citizen
模板算是纯FP吗我还是认为scala的程序员水平高
批判 goclojure这语言真不错
进入Programming版参与讨论
a*****e
发帖数: 1700
311
如果你要问我,我会说几乎没有什么是 FP 不适合的,就连内核以及嵌入式,FPGA 等
都有 FP 的解决方案。
这里我并不是说内核或者嵌入设备去跑 FP 语言的 runtime,而是说用 FP 的工具设计
的 DSL 跑在内核和嵌入设备上。比如你可以搜一下 se4L,它的一个实现是用 Haskell
写的,被用于证明所生成的内核的正确性。
I'm a big believer in DSL. 合理设计的 DSL 能够快速完成目标 domain 的编程要求
,所需要的只是一个有效的 DSL 开发环境,FP 在这方面非常适合。就象是一套合理设
计的库函数或者框架什么的,能够大幅度提高开发效率。但是库函数的组合调用通常都
是写在源程序里,写好就不可以改动。而 DSL 则是它本身可以被分析重组,写好之后
,还可以用程序处理变换,验证性质,生成高效代码等。元语言 (meta programming)
的技术目前也在抬头,但我认为还是 DSL 更灵活,因为 meta programming 所操作的
对象还是一个 general purpose 的语言所写的程序结构,很多时候我们只需要 domain
specific.
你说内存用得多,应该是 Copying GC 带来的,Java 这方面也是一样的,消耗内存总
是会比 C 多。Haskell 还有一个问题是 memory leak,这是 lazy language 的一个硬
伤。正确的程序不会有这种问题,虽然如何书写正确的 memory leak free 的 Haskell
程序有时候是一个 black art。
关于 immutable 的问题,如果你对现代的编译技术有了解,比如 SSA 什么的,就会发
现在编译局部变量时,其实 C 里面那些看起来是 mutable 的变量,都已经被转化成只
能赋值一次的虚拟寄存器了,所以是否 mutable 只影响需要共享数据的全局变量。
这方面,采取 immutable 的数据结构也会更适合 modern CPU,比如 cache-friendly
(sharing, no read/write barrier),比如 SIMD ,比如 thread 间数据的交换,可
以尽量避免 CAS 等。就连 Garbage Collection 也可以针对 cache 进行优化,而不需
要修改应用层面的东西。Scientific Computing 很多时候追求高效,结果把 C 或者
Fortran 的源程序调得乱糟糟,事后很难维护,长远来看是得不偿失的。
immutable 不占优势的一个情况,就是迅速产生大量垃圾,给 GC 造成负担过大。但这
毕竟很少见,通过 profiling 等技术也可以迅速发现问题所在,从应用层面可以调整
,比如适度允许 mutable 的结构,避免反复的 allocation。
还有一个弱点,主要是从算法层面,比如 graph 和 hashtable 的结构用 immutable
不能做,或者比较没效率。
所以 FP 也不是说拒绝 mutable,而是说如果以 immutable 为主,好处多多。

【在 m*********t 的大作中提到】
: 其实你们应该多说说:什么样的问题用 FP 来解决很合适,和 OOP 比较呢?。内核以
: 及嵌入式? 前端? game?数据分析?复杂的并行和需要大量内存的科学计算? 我看
: 到一些 haskell 的例子内存占用似乎比 C 要多好几倍(是不是 immutable 的原因?
: ),这样对于 memory bandwidth limit
: 的计算程序怎么弄?
: 还有说说这东西在大规模开发的时候代码可读性和可维护性?

d****i
发帖数: 4809
312
你说的FPGA都有FP的解决方案我倒是闻所未闻,FPGA一般用Verilog或者VHDL, 或者
SystemC,都是工业界的标准。

等都有 FP 的解决方案。

【在 a*****e 的大作中提到】
: 如果你要问我,我会说几乎没有什么是 FP 不适合的,就连内核以及嵌入式,FPGA 等
: 都有 FP 的解决方案。
: 这里我并不是说内核或者嵌入设备去跑 FP 语言的 runtime,而是说用 FP 的工具设计
: 的 DSL 跑在内核和嵌入设备上。比如你可以搜一下 se4L,它的一个实现是用 Haskell
: 写的,被用于证明所生成的内核的正确性。
: I'm a big believer in DSL. 合理设计的 DSL 能够快速完成目标 domain 的编程要求
: ,所需要的只是一个有效的 DSL 开发环境,FP 在这方面非常适合。就象是一套合理设
: 计的库函数或者框架什么的,能够大幅度提高开发效率。但是库函数的组合调用通常都
: 是写在源程序里,写好就不可以改动。而 DSL 则是它本身可以被分析重组,写好之后
: ,还可以用程序处理变换,验证性质,生成高效代码等。元语言 (meta programming)

a*****e
发帖数: 1700
313
不算是业界主流,多数还是 research 性质,顺手搜一下
http://raintown.org/lava/
http://cufp.org/conference/sessions/2012/peter-braam-parallel-s
ICFP/POPL 这类的 conference 上经常有这类的,也算热点之一吧

【在 d****i 的大作中提到】
: 你说的FPGA都有FP的解决方案我倒是闻所未闻,FPGA一般用Verilog或者VHDL, 或者
: SystemC,都是工业界的标准。
:
: 等都有 FP 的解决方案。

L***n
发帖数: 6727
314
比如?你所说的问题,即使存在,解决办法也应该是由专家维护高质量的库,而不是
使用DSL,在学术界,使用DSL的问题包括没有统一标准,混用DSL和已有语言C/C++
的代价,代码效率,等等,都是无法接受的。我本人倒是用过不少设计的不那么优美的
库,也试过一些DSL, 我宁愿用界面乱糟糟一些的C/C++/Fortran库,也不愿在我的代码
里用我自己都不知道怎么debug的DSL
t*****n
发帖数: 4908
315
这方面,采取 immutable 的数据结构也会更适合 modern CPU,比如 cache-friendly
(sharing, no read/write barrier),比如 SIMD ,比如 thread 间数据的交换,可
以尽量避免 CAS 等。就连 Garbage Collection 也可以针对 cache 进行优化,而不需
要修改应用层面的东西。Scientific Computing 很多时候追求高效,结果把 C 或者
Fortran 的源程序调得乱糟糟,事后很难维护,长远来看是得不偿失的。
真能码字。不过计算远没有你想的那么差。只有低水平的编程者,没有生来就乱的语言
。高手写的fortran,远胜入门者写的fp。

Haskell
)

【在 a*****e 的大作中提到】
: 如果你要问我,我会说几乎没有什么是 FP 不适合的,就连内核以及嵌入式,FPGA 等
: 都有 FP 的解决方案。
: 这里我并不是说内核或者嵌入设备去跑 FP 语言的 runtime,而是说用 FP 的工具设计
: 的 DSL 跑在内核和嵌入设备上。比如你可以搜一下 se4L,它的一个实现是用 Haskell
: 写的,被用于证明所生成的内核的正确性。
: I'm a big believer in DSL. 合理设计的 DSL 能够快速完成目标 domain 的编程要求
: ,所需要的只是一个有效的 DSL 开发环境,FP 在这方面非常适合。就象是一套合理设
: 计的库函数或者框架什么的,能够大幅度提高开发效率。但是库函数的组合调用通常都
: 是写在源程序里,写好就不可以改动。而 DSL 则是它本身可以被分析重组,写好之后
: ,还可以用程序处理变换,验证性质,生成高效代码等。元语言 (meta programming)

G***l
发帖数: 355
316
我最近也在做DSL,请问有什么好的讲FP实现DSL的书吗?以前用OO的语言做过,实现起
来比较麻烦。用了antlr做parser generator会好一些,但是还是挺麻烦的。

Haskell
)

【在 a*****e 的大作中提到】
: 如果你要问我,我会说几乎没有什么是 FP 不适合的,就连内核以及嵌入式,FPGA 等
: 都有 FP 的解决方案。
: 这里我并不是说内核或者嵌入设备去跑 FP 语言的 runtime,而是说用 FP 的工具设计
: 的 DSL 跑在内核和嵌入设备上。比如你可以搜一下 se4L,它的一个实现是用 Haskell
: 写的,被用于证明所生成的内核的正确性。
: I'm a big believer in DSL. 合理设计的 DSL 能够快速完成目标 domain 的编程要求
: ,所需要的只是一个有效的 DSL 开发环境,FP 在这方面非常适合。就象是一套合理设
: 计的库函数或者框架什么的,能够大幅度提高开发效率。但是库函数的组合调用通常都
: 是写在源程序里,写好就不可以改动。而 DSL 则是它本身可以被分析重组,写好之后
: ,还可以用程序处理变换,验证性质,生成高效代码等。元语言 (meta programming)

a*****e
发帖数: 1700
317
你说的也对,要是有方便用的,有稳定技术支持,已经被业界普遍采纳的产品就好了。
目前勉强能满足的也就是你说的这些设计上有缺陷的 C/C++/Fortran 库了。
但是 status quo 并非一成不变,没有理由不期待它朝更好的方向发展。
我谈的也都是一些 FP 的发展方向和(个人浅见)优势所在,并非都有成熟的产品。

【在 L***n 的大作中提到】
: 比如?你所说的问题,即使存在,解决办法也应该是由专家维护高质量的库,而不是
: 使用DSL,在学术界,使用DSL的问题包括没有统一标准,混用DSL和已有语言C/C++
: 的代价,代码效率,等等,都是无法接受的。我本人倒是用过不少设计的不那么优美的
: 库,也试过一些DSL, 我宁愿用界面乱糟糟一些的C/C++/Fortran库,也不愿在我的代码
: 里用我自己都不知道怎么debug的DSL

a*****e
发帖数: 1700
318
当然也不好一棒子全部打倒,我也就是最近接触这方面,有感而发。
为了追求效率全部改用 SIMD intrinsic 写东西,还真不是人干的事儿。

【在 t*****n 的大作中提到】
: 这方面,采取 immutable 的数据结构也会更适合 modern CPU,比如 cache-friendly
: (sharing, no read/write barrier),比如 SIMD ,比如 thread 间数据的交换,可
: 以尽量避免 CAS 等。就连 Garbage Collection 也可以针对 cache 进行优化,而不需
: 要修改应用层面的东西。Scientific Computing 很多时候追求高效,结果把 C 或者
: Fortran 的源程序调得乱糟糟,事后很难维护,长远来看是得不偿失的。
: 真能码字。不过计算远没有你想的那么差。只有低水平的编程者,没有生来就乱的语言
: 。高手写的fortran,远胜入门者写的fp。
:
: Haskell
: )

E*****m
发帖数: 25615
319

Sounds right to me.
But then why you have to bash those languages you don't know much?

【在 g*****g 的大作中提到】
: You can always use a new or old language in a new or old area. And there's
: always a chance of success. It's only that I wouldn't claim their
: superiority before their success. Let the reality do the talk, that's my
: stance.

g*****g
发帖数: 34805
320
Since when saying these languages are unproven is a bash?
In case you don't understand, all languages are unproven until proven
otherwise. FP or not.

【在 E*****m 的大作中提到】
:
: Sounds right to me.
: But then why you have to bash those languages you don't know much?

相关主题
大牛给讲讲monad吧?OOP里面的Object其实是actor
functional programming 哪本书经典适合入门怎么这里这么多人学python
也谈OOP跟FP之争粉FP的人是因为把电脑想象成图灵机了
进入Programming版参与讨论
a*****e
发帖数: 1700
321
书这方面我也不是特别了解,都是从 conference paper 和项目代码看过来的。你可以
搜索 IFIP DSL Conference,有 proceeding 什么的。
如果你用 Haskell,基础的理论就是 Monad, Applicative Functor, Arrow 这些。更
基础的是解释器的实现,Oleg 的网站上有些 paper: http://okmij.org/ftp/tagless-final/
而且要看你想做什么,Haskell 这边 parser 类的 DSL 已经很成熟了,hackage 上很
多。电子设计和 control 方面的 DSL 也比较多,上面提到的 Lava, 还有 Atom 都是。

【在 G***l 的大作中提到】
: 我最近也在做DSL,请问有什么好的讲FP实现DSL的书吗?以前用OO的语言做过,实现起
: 来比较麻烦。用了antlr做parser generator会好一些,但是还是挺麻烦的。
:
: Haskell
: )

E*****m
发帖数: 25615
322

You know you said more than "unproven".

【在 g*****g 的大作中提到】
: Since when saying these languages are unproven is a bash?
: In case you don't understand, all languages are unproven until proven
: otherwise. FP or not.

g*****g
发帖数: 34805
323
Right, and I am just being honest. If that hurts your feeling, you are too
sensitive.

【在 E*****m 的大作中提到】
:
: You know you said more than "unproven".

m*********t
发帖数: 527
324
为啥非要强调 “勉强能满足” 以及 “设计有缺陷呢” :p

【在 a*****e 的大作中提到】
: 你说的也对,要是有方便用的,有稳定技术支持,已经被业界普遍采纳的产品就好了。
: 目前勉强能满足的也就是你说的这些设计上有缺陷的 C/C++/Fortran 库了。
: 但是 status quo 并非一成不变,没有理由不期待它朝更好的方向发展。
: 我谈的也都是一些 FP 的发展方向和(个人浅见)优势所在,并非都有成熟的产品。

E*****m
发帖数: 25615
325

If you actually know those languages you bashed, it's a good thing.

【在 g*****g 的大作中提到】
: Right, and I am just being honest. If that hurts your feeling, you are too
: sensitive.

a*****e
发帖数: 1700
326
因为用起来不方便啊。脚本语言比如 python, R 之类的都能够进军这个领域不是正因
为 C/C++/Fortran 的库用起来不方便吗

【在 m*********t 的大作中提到】
: 为啥非要强调 “勉强能满足” 以及 “设计有缺陷呢” :p
G***l
发帖数: 355
327
简答来说就是做一个parser生成AST,跟相应的interpreter。比如一个basic语法的dsl
,当然我的肯定不会有一个正式的语言那么复杂。

是。

【在 a*****e 的大作中提到】
: 书这方面我也不是特别了解,都是从 conference paper 和项目代码看过来的。你可以
: 搜索 IFIP DSL Conference,有 proceeding 什么的。
: 如果你用 Haskell,基础的理论就是 Monad, Applicative Functor, Arrow 这些。更
: 基础的是解释器的实现,Oleg 的网站上有些 paper: http://okmij.org/ftp/tagless-final/
: 而且要看你想做什么,Haskell 这边 parser 类的 DSL 已经很成熟了,hackage 上很
: 多。电子设计和 control 方面的 DSL 也比较多,上面提到的 Lava, 还有 Atom 都是。

a*****e
发帖数: 1700
328
BASIC 已经有了,Lennart Augustsson 写的在这儿:
http://hackage.haskell.org/package/BASIC-0.1.5.0
http://augustss.blogspot.com/search/label/BASIC
这个实现很有趣,连 syntax 都和 BASIC 非常接近,虽然是 embeded DSL,也就是说
直接跳过了 parser 这部分
G***l
发帖数: 355
329
我想了解的就是如何用pattern matching之类的高级特性,高效的写出一个dsl。可惜
目前好像还没有这方面的书。

【在 a*****e 的大作中提到】
: BASIC 已经有了,Lennart Augustsson 写的在这儿:
: http://hackage.haskell.org/package/BASIC-0.1.5.0
: http://augustss.blogspot.com/search/label/BASIC
: 这个实现很有趣,连 syntax 都和 BASIC 非常接近,虽然是 embeded DSL,也就是说
: 直接跳过了 parser 这部分

a*****e
发帖数: 1700
330
如果你说的高效是指快速实现一个DSL的解释器,那么上面我给的那个blog链接是个很
好的例子。
首先,它绕过了 parser,因为程序本身虽然看起来象 BASIC,但实际上都是 Haskell
,直接代表 AST,所以省去很多前期的麻烦。这就叫做 embeded DSL。只需要定义
合适的 AST,然后对之进行 pattern match 解释执行就好了。
其次,embedded DSL 可以直接使用 host language 里面的值和函数,比如数字表达式
什么的,直接用,无须单独处理。你要做的工作可以完全放在你所定义的 DSL 的核心语
义上面。
最后,如果你追求 DSL 本身运行起来的效率,那么可以采取 finally taggless 的方
式,定义 combinator 来组建 DSL,它们本身就是 host language 里的函数,由
host language 的编译器直接编译,无须另写 AST 和解释器。我上面给的 Oleg 的链
接里有这个 paper。
所以从 embedded DSL 入手,实现一个新的 DSL 过程被大大简化,应该是相当有效率
的。
如果你不是打算用 Haskell,其它语言也可以,比如 scheme 这样的,macro 处理也相
当强大。

【在 G***l 的大作中提到】
: 我想了解的就是如何用pattern matching之类的高级特性,高效的写出一个dsl。可惜
: 目前好像还没有这方面的书。

相关主题
学FP不是为了写代码, 而是为了优秀的架构.FP更接近人的思维
go几天的一些感受有没有喜欢haskell的同学
Haskell很难学。。对 (im)mutability 的误解和深度理解
进入Programming版参与讨论
G***l
发帖数: 355
331
这个是很好,但是好像也偶缺陷。比如我以前用Java写,用户输入是各种文本,然后在
后台程序里,我在Java里面把这些文本parse成AST并且interpret,最后得到他们的结
果,比如:
用户写的dsl是MonthDiff(Date1, Date2) + 1 > SomeValue
我读入这个文本到monthControl, 并且在inputData里放入Date1, Date2, SomeValue的
值(从数据库或者什么地方读过来的)。然后写,
//evaluate里做parsing和interpret
result = evaluate(monthControl, inputData)
if(result)
{
//do business logic
}
这样用户就可以写dsl直接控制我程序里的logic。假如改用haskell用embedded的话,
我的haskell程序没法直接调用那个dsl,除非把那个dsl写到我的source code,然后动
态编译运行,但是我不想要那样。或者可以有什么类似swig之类的东西让我动态调用
haskell code,但是我没法把inputData传过去。
。用这种embedded dsl的方式好像就不能那样做了。

Haskell
心语

【在 a*****e 的大作中提到】
: 如果你说的高效是指快速实现一个DSL的解释器,那么上面我给的那个blog链接是个很
: 好的例子。
: 首先,它绕过了 parser,因为程序本身虽然看起来象 BASIC,但实际上都是 Haskell
: ,直接代表 AST,所以省去很多前期的麻烦。这就叫做 embeded DSL。只需要定义
: 合适的 AST,然后对之进行 pattern match 解释执行就好了。
: 其次,embedded DSL 可以直接使用 host language 里面的值和函数,比如数字表达式
: 什么的,直接用,无须单独处理。你要做的工作可以完全放在你所定义的 DSL 的核心语
: 义上面。
: 最后,如果你追求 DSL 本身运行起来的效率,那么可以采取 finally taggless 的方
: 式,定义 combinator 来组建 DSL,它们本身就是 host language 里的函数,由

g*****g
发帖数: 34805
332
I don't need to know those languages to know how much they are being used in
the industry. Simple as that.

【在 E*****m 的大作中提到】
:
: If you actually know those languages you bashed, it's a good thing.

a*****e
发帖数: 1700
333
你说的这个是经典的解释器,用户并不直接接触到实际的编译器,而是通过网站或什么
别的途径输入写好的脚本,你在后台来执行它。我这样理解没错吧?
你可以分两步走,第一步,先把 DSL AST 所需要的 data type 定义出来,然后对此写
一个解释器。调试过程中,可以直接用 datatype 写 AST,省去写 parser 的麻烦。
第一步做好了,然后就可以用 haskell parsec 之类的库把程序输入的字串转换为 AST
,略为学习一下 parsec 的用法就好了,简单的 recursive descent。
做 embeded DSL 可以省去第二步,但的确,在你的情况中,还是需要一个 parser 的
部分。

【在 G***l 的大作中提到】
: 这个是很好,但是好像也偶缺陷。比如我以前用Java写,用户输入是各种文本,然后在
: 后台程序里,我在Java里面把这些文本parse成AST并且interpret,最后得到他们的结
: 果,比如:
: 用户写的dsl是MonthDiff(Date1, Date2) + 1 > SomeValue
: 我读入这个文本到monthControl, 并且在inputData里放入Date1, Date2, SomeValue的
: 值(从数据库或者什么地方读过来的)。然后写,
: //evaluate里做parsing和interpret
: result = evaluate(monthControl, inputData)
: if(result)
: {

d*******i
发帖数: 77
334
我看到 functional programming 好处。
* immutable. 这点在并行运算中力量很大. 试想如果保证所有的arguments 都没有
state change那传统一以上的locking, synchronization就不存在了或没必要了。 大
大提高了程序可读性和可维护性。
* First class/Hight order functions. function 可以作为argument。 好处是大大
提高function 的易重用行和简便性。
* Syntax 简单。 上边讲过AST, Java 有很多事先制定 好的keyword match 到AST。
不过clojure 自己就是一个AST, 程序员可以自己定制macros, 所以程序syntax 很简
单又很flexible. 学一种语言不用象Java 那样去记它特定的语法。
由于强调 immutable , no state. FP 在现实production中多用于后台数据处理。 现
在在Big data 里很吃香。 但是有些时候是不可能完全no state, 比如你的程序调用
3rd party web service, 你就得持有一个state 去调用它, 在这个层级上
imperative
programming 就比较好一些。
E*****m
发帖数: 25615
335

in
So, after 10 years, you regress from a visionary who can predict Java's
success to
a trend follower.

【在 g*****g 的大作中提到】
: I don't need to know those languages to know how much they are being used in
: the industry. Simple as that.

m*********t
发帖数: 527
336
What about memory bandwith limit if you use all pure immutable objects? e.g.
I have a parallel gpu program that read + write 200 GB/s on the GDDR5 RAM.

【在 d*******i 的大作中提到】
: 我看到 functional programming 好处。
: * immutable. 这点在并行运算中力量很大. 试想如果保证所有的arguments 都没有
: state change那传统一以上的locking, synchronization就不存在了或没必要了。 大
: 大提高了程序可读性和可维护性。
: * First class/Hight order functions. function 可以作为argument。 好处是大大
: 提高function 的易重用行和简便性。
: * Syntax 简单。 上边讲过AST, Java 有很多事先制定 好的keyword match 到AST。
: 不过clojure 自己就是一个AST, 程序员可以自己定制macros, 所以程序syntax 很简
: 单又很flexible. 学一种语言不用象Java 那样去记它特定的语法。
: 由于强调 immutable , no state. FP 在现实production中多用于后台数据处理。 现

g*****g
发帖数: 34805
337
I am not being stubborn. I am being consistent. I saw Java succeeded 10
years ago the same reasons I don't see FP languages succeed today.
I have mentioned these reasons in many posts, for a language to be adopted
by massive as a general purpose language, it should be/have
1. Easy to learn, easy to use, easy to maintain
2. Big or quickly growing community
3. Killer framework or application
4. Adequate libraries
5. Company backing
Now Scala is the only FP language I know that has 2/3/4/5, that's one of the
reasons why I picked it up and used it for 2 years. Then I realize 1 is a
very big hurdle in a team setup with a big project, which can still be
overcame in a top notch company with top talents but the growth is hindered
nonetheless.
Other FP languages don't even come close. And none of them ever achieve 1.
Now maybe in the future there'll be new languages change all these. But I
can say for sure all well-known FP languages don't. For that reason they'll
remain niche languages. The best they can be is like javascript/Objective C
that excels in a specialized domain.

【在 E*****m 的大作中提到】
:
: in
: So, after 10 years, you regress from a visionary who can predict Java's
: success to
: a trend follower.

d**********x
发帖数: 4083
338
人总是在遇到问题的时候才想起来前人总结的经验。。。
编译原理一上来就说了语言的第一大concern就是learning cost...

the

【在 g*****g 的大作中提到】
: I am not being stubborn. I am being consistent. I saw Java succeeded 10
: years ago the same reasons I don't see FP languages succeed today.
: I have mentioned these reasons in many posts, for a language to be adopted
: by massive as a general purpose language, it should be/have
: 1. Easy to learn, easy to use, easy to maintain
: 2. Big or quickly growing community
: 3. Killer framework or application
: 4. Adequate libraries
: 5. Company backing
: Now Scala is the only FP language I know that has 2/3/4/5, that's one of the

E*****m
发帖数: 25615
339
I think you really need to put a quantifier "For enterprise software"
for almost everything you said.
In your 5 criteria, only (1) is forward looking. Others are just saying
"I follow the crowd", which is not really a bad thing, for a trend follower.
I guess people who create killer frameworks and libraries might
think differently.

the

【在 g*****g 的大作中提到】
: I am not being stubborn. I am being consistent. I saw Java succeeded 10
: years ago the same reasons I don't see FP languages succeed today.
: I have mentioned these reasons in many posts, for a language to be adopted
: by massive as a general purpose language, it should be/have
: 1. Easy to learn, easy to use, easy to maintain
: 2. Big or quickly growing community
: 3. Killer framework or application
: 4. Adequate libraries
: 5. Company backing
: Now Scala is the only FP language I know that has 2/3/4/5, that's one of the

g*****g
发帖数: 34805
340
Obviously I put a quantifier there, general purpose programming. e.g. Java
is much more than enterprise software, it's very successful on Android
platform as a UI language for personal software, gaming etc. It's not as
successful on PC/Mac but there are famous software like Eclipse and TurboTax
on Mac.
And no, I am not following the crowd. You can see all my criteria fit around
02, 03 already for Java, when I started promoting Java on this board. Yet I
am an early adopter, and not many people listened to me at that time.

follower.

【在 E*****m 的大作中提到】
: I think you really need to put a quantifier "For enterprise software"
: for almost everything you said.
: In your 5 criteria, only (1) is forward looking. Others are just saying
: "I follow the crowd", which is not really a bad thing, for a trend follower.
: I guess people who create killer frameworks and libraries might
: think differently.
:
: the

相关主题
对 (im)mutability 的误解和深度理解模板算是纯FP吗
王垠新文 为Java说句公道话批判 go
我对为什么使用FP的理解 (补)1st class citizen
进入Programming版参与讨论
E*****m
发帖数: 25615
341

TurboTax
around
I
I've the same question as the other guy. How can promoting java in 02 03 be
called "early"? When you are later than IBM, don't you think you're really
really late?

【在 g*****g 的大作中提到】
: Obviously I put a quantifier there, general purpose programming. e.g. Java
: is much more than enterprise software, it's very successful on Android
: platform as a UI language for personal software, gaming etc. It's not as
: successful on PC/Mac but there are famous software like Eclipse and TurboTax
: on Mac.
: And no, I am not following the crowd. You can see all my criteria fit around
: 02, 03 already for Java, when I started promoting Java on this board. Yet I
: am an early adopter, and not many people listened to me at that time.
:
: follower.

d*******i
发帖数: 77
342
Not quite understanding what you mean. Answer your question in assumption.
immutable objects does not mean that can not be garbage collected. I would
rather call it as immutable arguments rather than objects. As long as you do
not have reference with that argument, it can be garbage collected. On the
other hand, it saves memory, since you can only keep one copy of that object
and being reused by all the threads/cores, same concept as singleton.
Talking about performance. People do criticize the the way of "change"
immutable value, since you have to create another value by using the deep
copies. But clojure using some techniques called "Sharing Tech" to avoid
deep copy which is fast

g.

【在 m*********t 的大作中提到】
: What about memory bandwith limit if you use all pure immutable objects? e.g.
: I have a parallel gpu program that read + write 200 GB/s on the GDDR5 RAM.

g*****g
发帖数: 34805
343
Just ask how many people on this BBS have 10+ years of Java experience.
And you know why I am an early adopter.
BTW, academic experience doesn't count. I can see you don't have much
industry experience that's why you make a fuss on everything.

be
really

【在 E*****m 的大作中提到】
:
: TurboTax
: around
: I
: I've the same question as the other guy. How can promoting java in 02 03 be
: called "early"? When you are later than IBM, don't you think you're really
: really late?

r*g
发帖数: 3159
344
这个,在一个版面混了十年的本来就不多。。。

【在 g*****g 的大作中提到】
: Just ask how many people on this BBS have 10+ years of Java experience.
: And you know why I am an early adopter.
: BTW, academic experience doesn't count. I can see you don't have much
: industry experience that's why you make a fuss on everything.
:
: be
: really

g*****g
发帖数: 34805
345
好吧,如果你招人,你就会知道想招一个有10年java经验的人有多么难。

【在 r*g 的大作中提到】
: 这个,在一个版面混了十年的本来就不多。。。
d*******i
发帖数: 77
346
As a programmer, being consistent is being stubborn :) The learning cost to
use a new tool for a 0 experience worker compared with experience worker
using the same tool consistently for 100 years is way much lower.
Talking about big team and big enterprise, you are putting yourself as
mostly an application maintainer or consumer of "Adequate libraries" rather
than programmers or developers.
Anyway, it is the same topic of between doing job and enjoying your career.
The topic is talking about why functional programming is good and why is bad
rather than whether it will be successful in fuc*ng big enterprise. By the
way, killer framework was never wrote by a big team.

the

【在 g*****g 的大作中提到】
: I am not being stubborn. I am being consistent. I saw Java succeeded 10
: years ago the same reasons I don't see FP languages succeed today.
: I have mentioned these reasons in many posts, for a language to be adopted
: by massive as a general purpose language, it should be/have
: 1. Easy to learn, easy to use, easy to maintain
: 2. Big or quickly growing community
: 3. Killer framework or application
: 4. Adequate libraries
: 5. Company backing
: Now Scala is the only FP language I know that has 2/3/4/5, that's one of the

r*g
发帖数: 3159
347
我觉得真神说的一点有道理。这里是programming版,不是programmer版。你自然是资
深高手,但你看这么多问excel/matlab/c input问题的,我觉得超过一半来这里的,不
是职业程序员。那么你的职业建议就难免被一部分人当成废话。

【在 g*****g 的大作中提到】
: 好吧,如果你招人,你就会知道想招一个有10年java经验的人有多么难。
g*****g
发帖数: 34805
348
Talk is cheap. If you are talking about niche language in niche domain, set
the context straight. The reality is that none of these FP languages have
seen massive adoption in the industry. In fact, none of them cracked top 10
in this famous index.
http://www.tiobe.com/index.php/content/paperinfo/tpci/index.htm
Killer framework can be done by small team, killer app rarely is nowadays,
and when it is, it's usually due to brilliant idea, not the language. I
mentioned big team and big project due to practical reason for massive
adoption. It has nothing to do with my job.

to
rather
.
bad
the

【在 d*******i 的大作中提到】
: As a programmer, being consistent is being stubborn :) The learning cost to
: use a new tool for a 0 experience worker compared with experience worker
: using the same tool consistently for 100 years is way much lower.
: Talking about big team and big enterprise, you are putting yourself as
: mostly an application maintainer or consumer of "Adequate libraries" rather
: than programmers or developers.
: Anyway, it is the same topic of between doing job and enjoying your career.
: The topic is talking about why functional programming is good and why is bad
: rather than whether it will be successful in fuc*ng big enterprise. By the
: way, killer framework was never wrote by a big team.

d*******i
发帖数: 77
349
* Not having preference of functional programming vs object oriented
functional programming
* Not Talking which language is better than the other. They have different
ways/benefits/tradeoff to resolve the issues.
* Just want the topic of functional programming to be technical oriented.
* Industrial wide popularity does not mean any success of the language.
Actually it is a sadness of the language. I like Java, but when I worked
with a global fortune 100 client who has 3000 offshore cheap "developers"
fuc*Ng up Java everyday, I do not like my daily job any more. But that is
how enterprise makes the popular language and their standards.
:)

set
10

【在 g*****g 的大作中提到】
: Talk is cheap. If you are talking about niche language in niche domain, set
: the context straight. The reality is that none of these FP languages have
: seen massive adoption in the industry. In fact, none of them cracked top 10
: in this famous index.
: http://www.tiobe.com/index.php/content/paperinfo/tpci/index.htm
: Killer framework can be done by small team, killer app rarely is nowadays,
: and when it is, it's usually due to brilliant idea, not the language. I
: mentioned big team and big project due to practical reason for massive
: adoption. It has nothing to do with my job.
:

g*****g
发帖数: 34805
350
I am not against anyone using FP in a niche domain. I am merely talking why
existing FPs won't see massive adoption as a general purpose language.
I tend to quantify the success of the language to the values of projects
built on top of it. To that extent, the success of the language is also
largely correlated to its popularity.
At the end of the day, 3000 bad Java developers are still manageable. I
doubt you want to work with 3000 bad FP developers at all. Exactly one of
the reason FP is not going anywhere.

【在 d*******i 的大作中提到】
: * Not having preference of functional programming vs object oriented
: functional programming
: * Not Talking which language is better than the other. They have different
: ways/benefits/tradeoff to resolve the issues.
: * Just want the topic of functional programming to be technical oriented.
: * Industrial wide popularity does not mean any success of the language.
: Actually it is a sadness of the language. I like Java, but when I worked
: with a global fortune 100 client who has 3000 offshore cheap "developers"
: fuc*Ng up Java everyday, I do not like my daily job any more. But that is
: how enterprise makes the popular language and their standards.

相关主题
我还是认为scala的程序员水平高functional programming 哪本书经典适合入门
clojure这语言真不错也谈OOP跟FP之争
大牛给讲讲monad吧?OOP里面的Object其实是actor
进入Programming版参与讨论
E*****m
发帖数: 25615
351

Let me put it this way, you don't know my job and I've no interest to
tell you. But your speculations are all wrong.
And, I can assure you I've know enough people with more than 10 years
of java experience.
Let me say that again. Your prediction about Java was about
5 YEARS AFTER IBM rolled out its Java product. You call that "early"! Why?

【在 g*****g 的大作中提到】
: Just ask how many people on this BBS have 10+ years of Java experience.
: And you know why I am an early adopter.
: BTW, academic experience doesn't count. I can see you don't have much
: industry experience that's why you make a fuss on everything.
:
: be
: really

m*********t
发帖数: 527
352
比如我有一个 float 数组(长度大约 10^8 to 10^9,占用几个 G 的内存),然后我用
成千上万个 thread 来计算然后 update 数组里面元素的内容(为了保证 thread 不冲
突算法和 sync 都需要考虑)。而如果用 immutable 在这个情况怎么处理?

do
the
object

【在 d*******i 的大作中提到】
: Not quite understanding what you mean. Answer your question in assumption.
: immutable objects does not mean that can not be garbage collected. I would
: rather call it as immutable arguments rather than objects. As long as you do
: not have reference with that argument, it can be garbage collected. On the
: other hand, it saves memory, since you can only keep one copy of that object
: and being reused by all the threads/cores, same concept as singleton.
: Talking about performance. People do criticize the the way of "change"
: immutable value, since you have to create another value by using the deep
: copies. But clojure using some techniques called "Sharing Tech" to avoid
: deep copy which is fast

g*****g
发帖数: 34805
353
你小被鄙视,就是因为明明没啥业界经验,还要成天指点江山。我老00年开始用jsp写
网站,只不过02年才觉得java比C++有前途。你觉不觉我是不是early有用吗?看看你周
围有多少人有10年java经验不就得了。

?

【在 E*****m 的大作中提到】
:
: Let me put it this way, you don't know my job and I've no interest to
: tell you. But your speculations are all wrong.
: And, I can assure you I've know enough people with more than 10 years
: of java experience.
: Let me say that again. Your prediction about Java was about
: 5 YEARS AFTER IBM rolled out its Java product. You call that "early"! Why?

s***o
发帖数: 6934
354
I agree with most of you points.
but the last one just has no base at all. bad developers are bad developers,
they are cancer no matter what language they use.

why

【在 g*****g 的大作中提到】
: I am not against anyone using FP in a niche domain. I am merely talking why
: existing FPs won't see massive adoption as a general purpose language.
: I tend to quantify the success of the language to the values of projects
: built on top of it. To that extent, the success of the language is also
: largely correlated to its popularity.
: At the end of the day, 3000 bad Java developers are still manageable. I
: doubt you want to work with 3000 bad FP developers at all. Exactly one of
: the reason FP is not going anywhere.

s***o
发帖数: 6934
355
这好像已经超出了编程解决实际问题的范畴,而是艺术欣赏的范畴了。不然不可能得出
这个结论:
”Industrial wide popularity does not mean any success of the language.
Actually it is a sadness of the language“

【在 d*******i 的大作中提到】
: * Not having preference of functional programming vs object oriented
: functional programming
: * Not Talking which language is better than the other. They have different
: ways/benefits/tradeoff to resolve the issues.
: * Just want the topic of functional programming to be technical oriented.
: * Industrial wide popularity does not mean any success of the language.
: Actually it is a sadness of the language. I like Java, but when I worked
: with a global fortune 100 client who has 3000 offshore cheap "developers"
: fuc*Ng up Java everyday, I do not like my daily job any more. But that is
: how enterprise makes the popular language and their standards.

y***a
发帖数: 840
356
you would probabaly be intereted in delite project

dsl

【在 G***l 的大作中提到】
: 简答来说就是做一个parser生成AST,跟相应的interpreter。比如一个basic语法的dsl
: ,当然我的肯定不会有一个正式的语言那么复杂。
:
: 是。

g*****g
发帖数: 34805
357
There's a difference on how much a bad developer can kill a project.

【在 s***o 的大作中提到】
: 这好像已经超出了编程解决实际问题的范畴,而是艺术欣赏的范畴了。不然不可能得出
: 这个结论:
: ”Industrial wide popularity does not mean any success of the language.
: Actually it is a sadness of the language“

E*****m
发帖数: 25615
358

真的不騙你, 我周遭超過10年Java 經驗的車載斗量, 我自己在 02年以前就做了幾個
Java 業界的項目, 你鄙視有用嗎?
02 年也好意思叫預測, 你的臉皮厚度可以直接當裝甲防護罩了。

【在 g*****g 的大作中提到】
: 你小被鄙视,就是因为明明没啥业界经验,还要成天指点江山。我老00年开始用jsp写
: 网站,只不过02年才觉得java比C++有前途。你觉不觉我是不是early有用吗?看看你周
: 围有多少人有10年java经验不就得了。
:
: ?

t*s
发帖数: 1504
359
俺家当初订阅了一份报纸,叫电脑商情报
我记得97 98年开始,那报纸上面就整天宣传java改变世界了。国内最开始java的那批
人我认为是从1.0开始就追捧的。

【在 E*****m 的大作中提到】
:
: 真的不騙你, 我周遭超過10年Java 經驗的車載斗量, 我自己在 02年以前就做了幾個
: Java 業界的項目, 你鄙視有用嗎?
: 02 年也好意思叫預測, 你的臉皮厚度可以直接當裝甲防護罩了。

p*****2
发帖数: 21240
360

我应该是98年学的Java,当时觉得确实简单。随便看了看书做了一个东西花了两个多小
时,后来转到VC上花了我一晚上,况且我还是搞VC的。不过后来总觉得语言不灵活,所
以一直不太愿意转过去。但是有的时候想做点小程序,还是觉得Java比C++方便和快速
很多。后来接触了了脚本语言,发觉做点小东西脚本就够了。

【在 t*s 的大作中提到】
: 俺家当初订阅了一份报纸,叫电脑商情报
: 我记得97 98年开始,那报纸上面就整天宣传java改变世界了。国内最开始java的那批
: 人我认为是从1.0开始就追捧的。

相关主题
怎么这里这么多人学pythongo几天的一些感受
粉FP的人是因为把电脑想象成图灵机了Haskell很难学。。
学FP不是为了写代码, 而是为了优秀的架构.FP更接近人的思维
进入Programming版参与讨论
E*****m
发帖数: 25615
361

goodbug 會說別人都是跟風,只有他才是實在的。 等等看是不是這樣。

【在 t*s 的大作中提到】
: 俺家当初订阅了一份报纸,叫电脑商情报
: 我记得97 98年开始,那报纸上面就整天宣传java改变世界了。国内最开始java的那批
: 人我认为是从1.0开始就追捧的。

a*****e
发帖数: 1700
362
LOL, 这是要比谁最先搞 java 吗?我 97 年写的 Java 程序后来卖给Yahoo和华渊网。
后来再也没碰过 Java,所以 J2EE 这些我完全没接触过,不敢再古德霸面前抖啊,哈
哈哈

【在 p*****2 的大作中提到】
:
: 我应该是98年学的Java,当时觉得确实简单。随便看了看书做了一个东西花了两个多小
: 时,后来转到VC上花了我一晚上,况且我还是搞VC的。不过后来总觉得语言不灵活,所
: 以一直不太愿意转过去。但是有的时候想做点小程序,还是觉得Java比C++方便和快速
: 很多。后来接触了了脚本语言,发觉做点小东西脚本就够了。

g****r
发帖数: 1589
363
ca,这里全是前辈啊,我98年才摸到电脑这个东西,99年才在中学的机房里开始敲
basic,,,

【在 a*****e 的大作中提到】
: LOL, 这是要比谁最先搞 java 吗?我 97 年写的 Java 程序后来卖给Yahoo和华渊网。
: 后来再也没碰过 Java,所以 J2EE 这些我完全没接触过,不敢再古德霸面前抖啊,哈
: 哈哈

p*****2
发帖数: 21240
364

BSO年轻呀

【在 g****r 的大作中提到】
: ca,这里全是前辈啊,我98年才摸到电脑这个东西,99年才在中学的机房里开始敲
: basic,,,

t*****n
发帖数: 4908
365
用tubro c++的飘过。。。

【在 p*****2 的大作中提到】
:
: BSO年轻呀

l*********s
发帖数: 5409
366
BSO老江湖阿

【在 t*****n 的大作中提到】
: 用tubro c++的飘过。。。
g*****g
发帖数: 34805
367
LOL,不是读书写过一个applet就叫业界经验了,省省吧。02年在这BBS看好java的人很
少,要不然我
何必写那样的帖子。我老说的东西,好歹有10年前的帖子为证。你小明明半路出家,还
车载斗量呢,装逼有意思吗。

【在 E*****m 的大作中提到】
:
: goodbug 會說別人都是跟風,只有他才是實在的。 等等看是不是這樣。

g*****g
发帖数: 34805
368
如果我是跟风的,精华区也轮不到我来鼓吹。JSP 99年才出来的,我00年初用JSP写网
站的时候,是国内最早的一批,那时候更流行的是ASP和PHP。而在JSP出来之前,Java
的定位还局限于applet,没多大前途。你一吹就吹破了。

【在 E*****m 的大作中提到】
:
: goodbug 會說別人都是跟風,只有他才是實在的。 等等看是不是這樣。

E*****m
发帖数: 25615
369

你不是真神,亂猜做啥? 誰告訴你是 applet 了? 是正經用來賺錢的東西。
你也不知道我在哪幹, 氣急敗壞的跳上跳下是覺得人品還沒丟光嗎?
這 BBS 就是你的全部社會關係是嗎? 02 年在這裡『預測』Java 也好意思說?
真是好了不起, 連自己在丟人現眼都還不自覺,還留著丟人的證據到處獻寶,
不服你還真不行。

【在 g*****g 的大作中提到】
: LOL,不是读书写过一个applet就叫业界经验了,省省吧。02年在这BBS看好java的人很
: 少,要不然我
: 何必写那样的帖子。我老说的东西,好歹有10年前的帖子为证。你小明明半路出家,还
: 车载斗量呢,装逼有意思吗。

r********n
发帖数: 7441
370
拆分后每个子任务在一个core上以独占方式跑

【在 p*****2 的大作中提到】
:
: BSO年轻呀

相关主题
FP更接近人的思维王垠新文 为Java说句公道话
有没有喜欢haskell的同学我对为什么使用FP的理解 (补)
对 (im)mutability 的误解和深度理解模板算是纯FP吗
进入Programming版参与讨论
E*****m
发帖数: 25615
371

Java
你的志氣大概就是『國內』,『mitbbs』 這些地方是吧?
2002, Eclipse 都出來了, 更早前, Java 市場早就已經一片火熱了,Visual J++,
Visual Age for Java, Borland Jbuilder 這些早就 出好幾版了, MS 都已經推出 C
#了。
用 Java 寫 desktop application 早就流行了。 你要是 00 年給大家推薦用 Java

web 倒也還算早, 02 年就算太晚了。

【在 g*****g 的大作中提到】
: 如果我是跟风的,精华区也轮不到我来鼓吹。JSP 99年才出来的,我00年初用JSP写网
: 站的时候,是国内最早的一批,那时候更流行的是ASP和PHP。而在JSP出来之前,Java
: 的定位还局限于applet,没多大前途。你一吹就吹破了。

g*****g
发帖数: 34805
372
LOL,我老是有帖子做证据的,你小全靠上下嘴皮一翻,还证据呢?
我老00年开始写jsp应用,还不能叫early adopter,你丫不装逼会死吗?

【在 E*****m 的大作中提到】
:
: Java
: 你的志氣大概就是『國內』,『mitbbs』 這些地方是吧?
: 2002, Eclipse 都出來了, 更早前, Java 市場早就已經一片火熱了,Visual J++,
: Visual Age for Java, Borland Jbuilder 這些早就 出好幾版了, MS 都已經推出 C
: #了。
: 用 Java 寫 desktop application 早就流行了。 你要是 00 年給大家推薦用 Java
: 寫
: web 倒也還算早, 02 年就算太晚了。

g*****g
发帖数: 34805
373
我老00年写的网站就用jsp,还不算早?我老觉得Java写desktop app没前途,所以更早
没吹呀,要不
怎么说比你小有眼光呢?

,
C

【在 E*****m 的大作中提到】
:
: Java
: 你的志氣大概就是『國內』,『mitbbs』 這些地方是吧?
: 2002, Eclipse 都出來了, 更早前, Java 市場早就已經一片火熱了,Visual J++,
: Visual Age for Java, Borland Jbuilder 這些早就 出好幾版了, MS 都已經推出 C
: #了。
: 用 Java 寫 desktop application 早就流行了。 你要是 00 年給大家推薦用 Java
: 寫
: web 倒也還算早, 02 年就算太晚了。

E*****m
发帖数: 25615
374

jsp 寫個 hello world? 那麼愛講有存貼證據, 你把 00 年寫 JSP 的證據拿出來看
一下。

【在 g*****g 的大作中提到】
: 我老00年写的网站就用jsp,还不算早?我老觉得Java写desktop app没前途,所以更早
: 没吹呀,要不
: 怎么说比你小有眼光呢?
:
: ,
: C

g*****g
发帖数: 34805
375
00年ChinaRen有一部分是用JSP写的,现在网站是大不一样了,但还是JSP。
http://class.chinaren.com/index.jsp?bru=%2Fhome.do
你小02年拿Java写业界项目的证据呢?

【在 E*****m 的大作中提到】
:
: jsp 寫個 hello world? 那麼愛講有存貼證據, 你把 00 年寫 JSP 的證據拿出來看
: 一下。

c****e
发帖数: 1453
376
黄金时代阿, 那个时候给chinaren作parttime也有几千块一个月。

【在 g*****g 的大作中提到】
: 00年ChinaRen有一部分是用JSP写的,现在网站是大不一样了,但还是JSP。
: http://class.chinaren.com/index.jsp?bru=%2Fhome.do
: 你小02年拿Java写业界项目的证据呢?

b***e
发帖数: 1419
377
That's controversial. Why would there be 3k bad Java developer at first
place? Maybe it's too easy to be a bad Java developer. For Haskell, you
either are a good developer, or you cannot use it at all coz you're just too
dumb to understand it.

why

【在 g*****g 的大作中提到】
: I am not against anyone using FP in a niche domain. I am merely talking why
: existing FPs won't see massive adoption as a general purpose language.
: I tend to quantify the success of the language to the values of projects
: built on top of it. To that extent, the success of the language is also
: largely correlated to its popularity.
: At the end of the day, 3000 bad Java developers are still manageable. I
: doubt you want to work with 3000 bad FP developers at all. Exactly one of
: the reason FP is not going anywhere.

g*****g
发帖数: 34805
378
It's simply demand and supply. When demand is way over than supply,
everybody and their grandma can be a java developer. On the other hand, it
may take a genius to understand Haskell, yet some of them are still jobless,
too bad.

too

【在 b***e 的大作中提到】
: That's controversial. Why would there be 3k bad Java developer at first
: place? Maybe it's too easy to be a bad Java developer. For Haskell, you
: either are a good developer, or you cannot use it at all coz you're just too
: dumb to understand it.
:
: why

b***e
发帖数: 1419
379
Hmmm...I've seen enough java developers out of job, never seen a Haskell
developer out of job.

jobless,

【在 g*****g 的大作中提到】
: It's simply demand and supply. When demand is way over than supply,
: everybody and their grandma can be a java developer. On the other hand, it
: may take a genius to understand Haskell, yet some of them are still jobless,
: too bad.
:
: too

g*****g
发帖数: 34805
380
You probably know more java developers than total Haskell positions existing.

【在 b***e 的大作中提到】
: Hmmm...I've seen enough java developers out of job, never seen a Haskell
: developer out of job.
:
: jobless,

相关主题
批判 goclojure这语言真不错
1st class citizen大牛给讲讲monad吧?
我还是认为scala的程序员水平高functional programming 哪本书经典适合入门
进入Programming版参与讨论
b***e
发帖数: 1419
381
That's true. I know tons of J2EE experts who used to be tailors or chefs or
mailmen from "you know where". Guess that's why people are complaining H1B
is used up. But the point is, I did never see "some of the functional
programmers cannot land a job", while I do see quite "some of the (claimed
to be) Java developers cannot land a job". I personal interviewed many Java
developers with more than 10 year experience, and they cannot write a
simple exponential function correctly.

existing.

【在 g*****g 的大作中提到】
: You probably know more java developers than total Haskell positions existing.
g*****g
发帖数: 34805
382
If your so claimed functional programmers did not land a job as a functional
programmer, they are not a functional programmer. Or they are a jobless
functional programmer. Plain and simple.
When you can find a ton of bad java programmers employed, you know for sure
a good java programmer can get a good paycheck. That's the point.
The remaining Cobol programmers are probably very good, that doesn't mean
Cobol isn't dead.

or
H1B
Java

【在 b***e 的大作中提到】
: That's true. I know tons of J2EE experts who used to be tailors or chefs or
: mailmen from "you know where". Guess that's why people are complaining H1B
: is used up. But the point is, I did never see "some of the functional
: programmers cannot land a job", while I do see quite "some of the (claimed
: to be) Java developers cannot land a job". I personal interviewed many Java
: developers with more than 10 year experience, and they cannot write a
: simple exponential function correctly.
:
: existing.

d*******i
发帖数: 77
383
Talking with goodbug is like talking with American Java Enterprise architect
working in a same company for many years. As I do short term consulting, I
know a lot of these dudes.
Basically the words are dictating and no logic. Like "Plain and simple", "
You know for sure", "That is the point". If you see those statements, not
plain, either simple. I can not know for sure and not that point. In a real
life, you can beat the architects by using codes and white board. But in
BBS, you have to lose to someone with 10 years bbs tenure, while same cases
you have to back out when at client sites, the 10 years chief architects
saying, this is the point, you do not understand since I've been here 1
million years.
Bye!~ Backing out.

functional
sure

【在 g*****g 的大作中提到】
: If your so claimed functional programmers did not land a job as a functional
: programmer, they are not a functional programmer. Or they are a jobless
: functional programmer. Plain and simple.
: When you can find a ton of bad java programmers employed, you know for sure
: a good java programmer can get a good paycheck. That's the point.
: The remaining Cobol programmers are probably very good, that doesn't mean
: Cobol isn't dead.
:
: or
: H1B

g*****g
发帖数: 34805
384
LOL, are you serious about logic? Ironically I am the one who always brings
out numbers and killers app when comparing languages. Programming is all
about practicability. All these functional languages provocatives, they talk
about art and beauty instead.
I use the same arguments ten years ago, simply because history proved my
principles were correct, while people in opposition was wrong. Now time has
changed, but the stance isn't. I am merely asking one question, what changes
have given FP new edge? I haven't heard any.
Learning a language is like buying a stock. You can pick a winner and
constantly compare it to its competition. Or you can pick a loser and boast
it all day long. We all hope to make money out of it, and the feeling is
hurt when we are on the wrong side.

architect
I
real
cases

【在 d*******i 的大作中提到】
: Talking with goodbug is like talking with American Java Enterprise architect
: working in a same company for many years. As I do short term consulting, I
: know a lot of these dudes.
: Basically the words are dictating and no logic. Like "Plain and simple", "
: You know for sure", "That is the point". If you see those statements, not
: plain, either simple. I can not know for sure and not that point. In a real
: life, you can beat the architects by using codes and white board. But in
: BBS, you have to lose to someone with 10 years bbs tenure, while same cases
: you have to back out when at client sites, the 10 years chief architects
: saying, this is the point, you do not understand since I've been here 1

b***e
发帖数: 1419
385
Well, if that's by definition your logic, then I certainly cannot beat you
on it. But I disagree. To your point, you can similarly argue most of the
PHDs hired by Google or Facebook are jobless computer science researchers.
In my opinion, a functional developer, as smart and capable she/he is,
usually lands a good job easily, regardless if the job is directly related
to functional programming or not. The thoughts and insights gained from
understanding functional languages is beyond merely using them as
development tools.

functional
sure

【在 g*****g 的大作中提到】
: If your so claimed functional programmers did not land a job as a functional
: programmer, they are not a functional programmer. Or they are a jobless
: functional programmer. Plain and simple.
: When you can find a ton of bad java programmers employed, you know for sure
: a good java programmer can get a good paycheck. That's the point.
: The remaining Cobol programmers are probably very good, that doesn't mean
: Cobol isn't dead.
:
: or
: H1B

g*****g
发帖数: 34805
386
Your logic is twisted. A good developer is good because he/she can get the
job done. Not because he/she can do FP. Do you have any statistics to prove
developers that know FP are better? If not, this self-claimed superiority is
nothing but zhuangbility.

the

【在 b***e 的大作中提到】
: Well, if that's by definition your logic, then I certainly cannot beat you
: on it. But I disagree. To your point, you can similarly argue most of the
: PHDs hired by Google or Facebook are jobless computer science researchers.
: In my opinion, a functional developer, as smart and capable she/he is,
: usually lands a good job easily, regardless if the job is directly related
: to functional programming or not. The thoughts and insights gained from
: understanding functional languages is beyond merely using them as
: development tools.
:
: functional

E*****m
发帖数: 25615
387

prove
is
Question for you. Does arguing this make more money for you?
If yes, how? If not, are you 裝B ing ?

【在 g*****g 的大作中提到】
: Your logic is twisted. A good developer is good because he/she can get the
: job done. Not because he/she can do FP. Do you have any statistics to prove
: developers that know FP are better? If not, this self-claimed superiority is
: nothing but zhuangbility.
:
: the

g*****g
发帖数: 34805
388
Java developers make much more money than Haskell developers, that's just a
fact.
Since when stating fact is also zhuangbility?
http://www.indeed.com/salary?q1=java&l1=&q2=haskell&l2=&tm=1
Where's your proof of industry java project in 2002 BTW? You were exposed
the other day and now you are back again?

【在 E*****m 的大作中提到】
:
: prove
: is
: Question for you. Does arguing this make more money for you?
: If yes, how? If not, are you 裝B ing ?

A*******t
发帖数: 443
389
http://www.indeed.com/salary?q1=java&l1=&q2=Ocaml&l2=&tm=1
不过估计是Jane Street一家之力

a

【在 g*****g 的大作中提到】
: Java developers make much more money than Haskell developers, that's just a
: fact.
: Since when stating fact is also zhuangbility?
: http://www.indeed.com/salary?q1=java&l1=&q2=haskell&l2=&tm=1
: Where's your proof of industry java project in 2002 BTW? You were exposed
: the other day and now you are back again?

E*****m
发帖数: 25615
390

a
Now you think there are other thing than money that you care?
If you didn't understand the question, I'm asking does YOU arguing this
make YOU more money? Can you answer this?
Did I promise I'll prove it to you? No. You don't need to believe me. It's
not even
the point. You can't defend your own argument, so you have to resort to
personal attach. So pathetic.

【在 g*****g 的大作中提到】
: Java developers make much more money than Haskell developers, that's just a
: fact.
: Since when stating fact is also zhuangbility?
: http://www.indeed.com/salary?q1=java&l1=&q2=haskell&l2=&tm=1
: Where's your proof of industry java project in 2002 BTW? You were exposed
: the other day and now you are back again?

相关主题
也谈OOP跟FP之争粉FP的人是因为把电脑想象成图灵机了
OOP里面的Object其实是actor学FP不是为了写代码, 而是为了优秀的架构.
怎么这里这么多人学pythongo几天的一些感受
进入Programming版参与讨论
a****i
发帖数: 1182
391
you need not answer this nonsense question
everyone posts here for money or zhuangB?
Did he try to answer the question before he asked?
or M$ pays him for arguing here

a

【在 g*****g 的大作中提到】
: Java developers make much more money than Haskell developers, that's just a
: fact.
: Since when stating fact is also zhuangbility?
: http://www.indeed.com/salary?q1=java&l1=&q2=haskell&l2=&tm=1
: Where's your proof of industry java project in 2002 BTW? You were exposed
: the other day and now you are back again?

E*****m
发帖数: 25615
392

Actually, this is goodbug's idea. He thinks only money is
important, everything else is zhuangB.

【在 a****i 的大作中提到】
: you need not answer this nonsense question
: everyone posts here for money or zhuangB?
: Did he try to answer the question before he asked?
: or M$ pays him for arguing here
:
: a

g*****g
发帖数: 34805
393
Not really, I am just disgusted by someone's self-claim superiority.
Some people feel they are better programmers because they know FP, but they
don't have any number to back it up, they don't even program FP for a living
. Now that's textbook zhuangB.
Money is not everything. But at least that's a number that's objective and
easy to find on Internet.

【在 E*****m 的大作中提到】
:
: Actually, this is goodbug's idea. He thinks only money is
: important, everything else is zhuangB.

g*****g
发帖数: 34805
394
Good find. Though only 43 jobs compared to 66K for Java. It's more or less a
skill to kill the dragon.
http://www.indeed.com/jobs?q=Ocaml&l=

【在 A*******t 的大作中提到】
: http://www.indeed.com/salary?q1=java&l1=&q2=Ocaml&l2=&tm=1
: 不过估计是Jane Street一家之力
:
: a

b***e
发帖数: 1419
395
I didn't get it where my logic is twisted. Therefore I prefer to question
your skills of reading comprehension. Nonetheless, with my limited personal
experience, I do observe average FP developers exhibiting much more
superior smartness and capability over Java developers (I did work in both
contexts for non-trivial/significant time). Also, to my observation FP
developers are either making more of a fortune or getting a better social
status than mere Java developers.

prove
is

【在 g*****g 的大作中提到】
: Your logic is twisted. A good developer is good because he/she can get the
: job done. Not because he/she can do FP. Do you have any statistics to prove
: developers that know FP are better? If not, this self-claimed superiority is
: nothing but zhuangbility.
:
: the

g*****g
发帖数: 34805
396
Your observation. LOL. Do you know 4 big cows in this BBS?
My friends, my relatives, my neighbors and my classmates.
I show numbers to prove FP programmers would have a hard time to find a job.
Many of your brilliant FP programmers are stuck in thousand year postdoc,
you can't find a good explanation otherwisefor $28K average salary for
Haskell jobs.
And to show you why personal observation can be so biased. Most of java
programmers in my company make more than $200K a year. If they work for more
than 3 years in the company they are most likely a millionaire due to stock
option. But I wouldn't use that personal observation to generalize social
status for a language's developers like you just did.

personal

【在 b***e 的大作中提到】
: I didn't get it where my logic is twisted. Therefore I prefer to question
: your skills of reading comprehension. Nonetheless, with my limited personal
: experience, I do observe average FP developers exhibiting much more
: superior smartness and capability over Java developers (I did work in both
: contexts for non-trivial/significant time). Also, to my observation FP
: developers are either making more of a fortune or getting a better social
: status than mere Java developers.
:
: prove
: is

E*****m
发帖数: 25615
397

they
living
Hitting strawman?
NOW money is not everything? So, what else is important?

【在 g*****g 的大作中提到】
: Not really, I am just disgusted by someone's self-claim superiority.
: Some people feel they are better programmers because they know FP, but they
: don't have any number to back it up, they don't even program FP for a living
: . Now that's textbook zhuangB.
: Money is not everything. But at least that's a number that's objective and
: easy to find on Internet.

g*****g
发帖数: 34805
398
Like humble and not zhuangB even if you know how to kill a dragon.

【在 E*****m 的大作中提到】
:
: they
: living
: Hitting strawman?
: NOW money is not everything? So, what else is important?

b***e
发帖数: 1419
399
I question the accuracy of the Haskell developer salary report, well, yes,
depending on how do you classify Haskell developers. Most of the Haskell
developers are truly academic researchers. Those people who worked with me
before are mostly tenure professors at some universities. So far I didn't
find a single case in my list of 4 big cows who's "thousand years of post-
doc". This is not biology (sorry for my candor, biologists). They might
not be making as high as 200k per year as far as base salary is concerned,
but undeniably, they are at a higher social status and earn more
professional respects than mere Java developers. Their contribution to
science and to the development of human society is not measured through how
many dollars they make per year.
On the other hand, even if people who are a bit dumber than those smart
asses, like me, who ended up in the software industry, are benefiting from
the valuable experience from programming functional languages. As I said in
another post, the insights that people gain from understanding how FPLs
work can great improve the personal's vision in software engineering. For
an instance, like Wang Yin said, visitor pattern doesn't exist in Haskell (
as a representative of FPL), because it's just a language feature. That
being said, if you did program Haskell and understand how pattern matching
works there, you would have a much better understanding of why the visitor
pattern is constructed that way. That's know-why, which beyond a mere know-
how. Furthermore, with the involvement of Java generics, sometimes there
are variants of visitor patterns that are pretty hacky and tricky. But if
you did know that there's something call Generalized Algebraic Datatype (
GADT) in Haskell, you would realized those hacks are not totally out of
nowhere from some smart-ass' mind. They are just mimicking the enhanced
pattern matching in GADT. This is know-why again, which is beyond a mere
know-how. Only with know-how can you be original and creative to create new
patterns that suite new needs.
I do not merely take a programming language as a development tool and get
religious about it. I tend to see through the surface and reach the essence
. When I look at Haskell, I see Algebraic Data Type and type directed
pattern matching, I see non-strictness/lazy evaluation, I see functional
closures and lambda lifting, I see type/constructor class based overloading,
I see implicit parameters, I see monad based side effects. When I look at
Lisp, I see meta programming, I see macros, I see CLOS, I see explicit
continuation passing. When I see Java, I see object oriented paradigm, I
see OO based encapsulation, I see inclusion polymorphism (subtyping), I see
singly inheritance hierarchy with interfaces, I see garbage collection, I
see just-in-time compilation, and I see weak references. When I see Scala,
I see mixins, I see type inference for second order polymorphism, I see
light-weight lock free processes.
If your final career goal is to be a senior^n Java engineer and get
comfortable with 200k yearly income and enjoy it for the rest of your life,
that's good for you. I had been there and done that years ago, and I moved
on beyond that.

job.
more
stock

【在 g*****g 的大作中提到】
: Your observation. LOL. Do you know 4 big cows in this BBS?
: My friends, my relatives, my neighbors and my classmates.
: I show numbers to prove FP programmers would have a hard time to find a job.
: Many of your brilliant FP programmers are stuck in thousand year postdoc,
: you can't find a good explanation otherwisefor $28K average salary for
: Haskell jobs.
: And to show you why personal observation can be so biased. Most of java
: programmers in my company make more than $200K a year. If they work for more
: than 3 years in the company they are most likely a millionaire due to stock
: option. But I wouldn't use that personal observation to generalize social

g*****g
发帖数: 34805
400
It's one thing saying learning FP can benefit programming skills, which I
definitely agree. It's another thing saying FP programmers are better than
Java programmers, which is really a joke. They can't even find a job as a FP
programmers, if better means killing dragon, sure, but nobody really cares.
There are a lot of things to learn and all of them can have some benefits,
the question is how much? Personally I believe no matter what programming
language you are using, mastering the mainstream frameworks and getting keen
on the hot technologies like NoSQL, Cloud etc. is more beneficial than
learning FP. But it's your own choice.
At the end of the day, however, programming is an engineering practice. The
end products prove the usefulness of the language and the skills the
programmers practicing them. It's not that difficult to quantify. You just
have nothing to back up your claims with the worlds full of Java products
and FP products hard to find. Talk is cheap. How much you or me earn is not
the matter. The matter is not to talk bullshit and only proof is the four
big cows you know, which is still all you have with your long thesis, that's
not gonna work for techies.

me
how

【在 b***e 的大作中提到】
: I question the accuracy of the Haskell developer salary report, well, yes,
: depending on how do you classify Haskell developers. Most of the Haskell
: developers are truly academic researchers. Those people who worked with me
: before are mostly tenure professors at some universities. So far I didn't
: find a single case in my list of 4 big cows who's "thousand years of post-
: doc". This is not biology (sorry for my candor, biologists). They might
: not be making as high as 200k per year as far as base salary is concerned,
: but undeniably, they are at a higher social status and earn more
: professional respects than mere Java developers. Their contribution to
: science and to the development of human society is not measured through how

相关主题
Haskell很难学。。对 (im)mutability 的误解和深度理解
FP更接近人的思维王垠新文 为Java说句公道话
有没有喜欢haskell的同学我对为什么使用FP的理解 (补)
进入Programming版参与讨论
n******t
发帖数: 4406
401
But not many people make money directly from knowing functional programming
language. On the other hand, I think any job,that pays your directly because
you are using a particular language, is not so good as a job. It can give
you are decent life maybe, but might be not all that interesting.
Knowing a language that is not popular in industry and still learning or
even mastering it, could be an evidence the learner is interested in various
programming aspects and are probably more skillful than the normal
"learn-something-to-get-a-job" type of programmer. Very few programmers who
know FP just know FP. Most of them knows enough C/C++/Java before that and
they are probably going to learn a lot more in the future. So in this
regard, it is probably right to say FP programmer are usually better in
probablity. It does not mean learning Java means you are stupid though.

FP
cares.
keen
The

【在 g*****g 的大作中提到】
: It's one thing saying learning FP can benefit programming skills, which I
: definitely agree. It's another thing saying FP programmers are better than
: Java programmers, which is really a joke. They can't even find a job as a FP
: programmers, if better means killing dragon, sure, but nobody really cares.
: There are a lot of things to learn and all of them can have some benefits,
: the question is how much? Personally I believe no matter what programming
: language you are using, mastering the mainstream frameworks and getting keen
: on the hot technologies like NoSQL, Cloud etc. is more beneficial than
: learning FP. But it's your own choice.
: At the end of the day, however, programming is an engineering practice. The

G***l
发帖数: 355
402
你又犯晕了。我没看到有人说FP programmer programmer比java好,至少几个发言比较
多的id都没这么说。事实上除了acdemic之外,绝大多数fp progammer同时也大量使用
java,c#,c++,python这些非fp语言。完全是你有受迫害妄想症,看到别人说fp好,就偏
要往别人意思是java不好联想,看到比人说fp有前途就往java没前途去理解。我对这个
thread里面你的观点鉴定完毕。

FP
cares.
keen
The

【在 g*****g 的大作中提到】
: It's one thing saying learning FP can benefit programming skills, which I
: definitely agree. It's another thing saying FP programmers are better than
: Java programmers, which is really a joke. They can't even find a job as a FP
: programmers, if better means killing dragon, sure, but nobody really cares.
: There are a lot of things to learn and all of them can have some benefits,
: the question is how much? Personally I believe no matter what programming
: language you are using, mastering the mainstream frameworks and getting keen
: on the hot technologies like NoSQL, Cloud etc. is more beneficial than
: learning FP. But it's your own choice.
: At the end of the day, however, programming is an engineering practice. The

g*****g
发帖数: 34805
403

你就别圆了,这位底下写得清清楚楚,FP programmer从IQ,fortune, social status
全方
位完灭java developer。我老就是要他提供一些数字来证明一下,这位就开始玩四大牛
人的把戏。
我没啥迫害妄想症,那位blaze 10年前就鼓吹过Haskell,跟我争过FP会如何牛逼云云
,你不信可以去google,事实上是这10年,FP的地位几乎没有提高,倒是他看不起的
Java地位提高了很多。他就是老脸拉不下来。
personal

【在 G***l 的大作中提到】
: 你又犯晕了。我没看到有人说FP programmer programmer比java好,至少几个发言比较
: 多的id都没这么说。事实上除了acdemic之外,绝大多数fp progammer同时也大量使用
: java,c#,c++,python这些非fp语言。完全是你有受迫害妄想症,看到别人说fp好,就偏
: 要往别人意思是java不好联想,看到比人说fp有前途就往java没前途去理解。我对这个
: thread里面你的观点鉴定完毕。
:
: FP
: cares.
: keen
: The

g*****g
发帖数: 34805
404
As I mentioned, there are so much to learn in programming. What's so special
about FP? There's simply no proof learning FP is more beneficial than using
the time to learn other things like new frameworks and technologies.

programming
because
various
who

【在 n******t 的大作中提到】
: But not many people make money directly from knowing functional programming
: language. On the other hand, I think any job,that pays your directly because
: you are using a particular language, is not so good as a job. It can give
: you are decent life maybe, but might be not all that interesting.
: Knowing a language that is not popular in industry and still learning or
: even mastering it, could be an evidence the learner is interested in various
: programming aspects and are probably more skillful than the normal
: "learn-something-to-get-a-job" type of programmer. Very few programmers who
: know FP just know FP. Most of them knows enough C/C++/Java before that and
: they are probably going to learn a lot more in the future. So in this

g****t
发帖数: 31659
405
计算机本科的计算理论基础什么的,一般都要学FP吧?
就算不学商用FP,Lambda Calculus之类的东西,很多基础课本都有包括.
这个和图灵机类似.属于基本的基础.一个程序员,能没学过Turing机么?
虽然不一定有用.

As I mentioned, there are so much to learn in programming. What's so special
about FP? There's simply no proof learning FP is more beneficial than using
the time to learn other things like new frameworks and technologies.
programming
because
various
who

【在 g*****g 的大作中提到】
: As I mentioned, there are so much to learn in programming. What's so special
: about FP? There's simply no proof learning FP is more beneficial than using
: the time to learn other things like new frameworks and technologies.
:
: programming
: because
: various
: who

g*****g
发帖数: 34805
406
计算理论本来就不是必修课。就跟图像处理,图形学,人工智能,这些都是专业方向,
不是CS本科必修课。
我打赌这版上大多数人都没学过图像处理和图形学,但我不会说什么学过图形学的秒杀
没学过的云云。

special
using

【在 g****t 的大作中提到】
: 计算机本科的计算理论基础什么的,一般都要学FP吧?
: 就算不学商用FP,Lambda Calculus之类的东西,很多基础课本都有包括.
: 这个和图灵机类似.属于基本的基础.一个程序员,能没学过Turing机么?
: 虽然不一定有用.
:
: As I mentioned, there are so much to learn in programming. What's so special
: about FP? There's simply no proof learning FP is more beneficial than using
: the time to learn other things like new frameworks and technologies.
: programming
: because

g****t
发帖数: 31659
407
CS哪个课学图灵机? (或者哪个程序员对图灵机感兴趣。)
一般也都会学到Lambda Calculs,部分递归函数什么的。

计算理论本来就不是必修课。就跟图像处理,图形学,人工智能,这些都是专业方向,
不是CS本科必修课。
我打赌这版上大多数人都没学过图像处理和图形学,但我不会说什么学过图形学的秒杀
没学过的云云。
special
using

【在 g*****g 的大作中提到】
: 计算理论本来就不是必修课。就跟图像处理,图形学,人工智能,这些都是专业方向,
: 不是CS本科必修课。
: 我打赌这版上大多数人都没学过图像处理和图形学,但我不会说什么学过图形学的秒杀
: 没学过的云云。
:
: special
: using

g*****g
发帖数: 34805
408
形式语言与自动机,选修课。

【在 g****t 的大作中提到】
: CS哪个课学图灵机? (或者哪个程序员对图灵机感兴趣。)
: 一般也都会学到Lambda Calculs,部分递归函数什么的。
:
: 计算理论本来就不是必修课。就跟图像处理,图形学,人工智能,这些都是专业方向,
: 不是CS本科必修课。
: 我打赌这版上大多数人都没学过图像处理和图形学,但我不会说什么学过图形学的秒杀
: 没学过的云云。
: special
: using

A*******t
发帖数: 443
409
说得好像学了fp,连java都不会写了似的

a

【在 g*****g 的大作中提到】
: Good find. Though only 43 jobs compared to 66K for Java. It's more or less a
: skill to kill the dragon.
: http://www.indeed.com/jobs?q=Ocaml&l=

b***e
发帖数: 1419
410
事实上scala和javascript都属于FP,只不过不像Haskell那么纯粹。FP的本质在于对
first class function和higher order function的支持。
我对四大牛人什么的说实话不感兴趣。我十年前也并非鼓吹FP。当年你挑起一个帖子,
说你认为functional language programmer都是"freaks who cannot think straight"
(大体是你的原话吧)。我路见不平而已。其中是非曲直有目共睹。
我职业潜水员,一向不太发帖子,这次多说几句主要是你们这些Java轮bash FP过激了
。我一向鼓励对FP的兴趣和探究,不愿看到这些志向过早的为世俗所羁。或有矫枉过正
。言止此尔。

status

【在 g*****g 的大作中提到】
: 形式语言与自动机,选修课。
相关主题
我对为什么使用FP的理解 (补)1st class citizen
模板算是纯FP吗我还是认为scala的程序员水平高
批判 goclojure这语言真不错
进入Programming版参与讨论
s***o
发帖数: 6934
411
why is there a line drawn between functional language programmers and non
functional language programmers? It's the first time I've heard of it. It's
stupid.

straight"

【在 b***e 的大作中提到】
: 事实上scala和javascript都属于FP,只不过不像Haskell那么纯粹。FP的本质在于对
: first class function和higher order function的支持。
: 我对四大牛人什么的说实话不感兴趣。我十年前也并非鼓吹FP。当年你挑起一个帖子,
: 说你认为functional language programmer都是"freaks who cannot think straight"
: (大体是你的原话吧)。我路见不平而已。其中是非曲直有目共睹。
: 我职业潜水员,一向不太发帖子,这次多说几句主要是你们这些Java轮bash FP过激了
: 。我一向鼓励对FP的兴趣和探究,不愿看到这些志向过早的为世俗所羁。或有矫枉过正
: 。言止此尔。
:
: status

h*i
发帖数: 3446
412
I can understand your frustration.
But, the truth of the matter is that a programmer who is versed in FP is
indeed considered by almost every employer as a better programmer than one
who is not versed in FP, everything else being equal. This is simply a fact.
You can be disgusted about the fact, but it does not change the fact.
If you are really practical minded as you seem to claim yourself to be, you
may want to work with the reality rather than whine about it.

they
living

【在 g*****g 的大作中提到】
: Not really, I am just disgusted by someone's self-claim superiority.
: Some people feel they are better programmers because they know FP, but they
: don't have any number to back it up, they don't even program FP for a living
: . Now that's textbook zhuangB.
: Money is not everything. But at least that's a number that's objective and
: easy to find on Internet.

h*i
发帖数: 3446
413
I am among those people who wrote almost exclusively in Java since 1997. I
was invited to Sun's dinners in Beijing and totally bought their propaganda
(compare with C++, Java was so much better). In those days, one could
easily win awards by writing Java applets, which I got a couple myself.
Later on, I even wrote 3D games in Java. Fun times...
Then Java became enterprisy, with all those frameworks and architecture
astronauts running the show, and lost all of its charm...
Now I wrote almost exclusively in Clojure...

【在 t*s 的大作中提到】
: 俺家当初订阅了一份报纸,叫电脑商情报
: 我记得97 98年开始,那报纸上面就整天宣传java改变世界了。国内最开始java的那批
: 人我认为是从1.0开始就追捧的。

h*i
发帖数: 3446
414
There isn't a line, but "FP programmers" are those programmers who can do FP
, "non-FP programmers" are those who cannot. Because all programmers can do
non-FP, and only "FP programmers" can do FP, "FP programmers" are normally
considered better programmers, everything else being equal.

s

【在 s***o 的大作中提到】
: why is there a line drawn between functional language programmers and non
: functional language programmers? It's the first time I've heard of it. It's
: stupid.
:
: straight"

h*i
发帖数: 3446
415
There's no such thing as a FP programmer who does not know how to program in
Java if they need to. If they can make a good living without doing that,
why should they. After all, a Java programmer is like a janitor these days,
it's a replaceable commodity because every one can do it.
Truth hurts.

FP
cares.
keen
The

【在 g*****g 的大作中提到】
: It's one thing saying learning FP can benefit programming skills, which I
: definitely agree. It's another thing saying FP programmers are better than
: Java programmers, which is really a joke. They can't even find a job as a FP
: programmers, if better means killing dragon, sure, but nobody really cares.
: There are a lot of things to learn and all of them can have some benefits,
: the question is how much? Personally I believe no matter what programming
: language you are using, mastering the mainstream frameworks and getting keen
: on the hot technologies like NoSQL, Cloud etc. is more beneficial than
: learning FP. But it's your own choice.
: At the end of the day, however, programming is an engineering practice. The

g*****g
发帖数: 34805
416
I am not frustrated, and why should I? If you are at all being about
practical, you should notice functional languages ain't spring chicken, in
fact, they've existed for much longer time than OO languages and they never
took off. Plus, there's absolutely no data supporting FP programmers are
better. If anything, the salary on indeed suggests their market value is
just lower, much lower. Now that's some fact.

fact.
you

【在 h*i 的大作中提到】
: I can understand your frustration.
: But, the truth of the matter is that a programmer who is versed in FP is
: indeed considered by almost every employer as a better programmer than one
: who is not versed in FP, everything else being equal. This is simply a fact.
: You can be disgusted about the fact, but it does not change the fact.
: If you are really practical minded as you seem to claim yourself to be, you
: may want to work with the reality rather than whine about it.
:
: they
: living

g*****g
发帖数: 34805
417
LOL, truth hurts, doesn't it?
http://www.indeed.com/salary?q1=haskell&l1=&q2=java&l2=&q3=sche
Not to mention Java jobs are like 10 times than all these languages combined.
If you are really good, in the normal distribution you can get in the far
right end.
By the way, your clojure peers ain't doing very well either. I feel sorry
for them.

in
,

【在 h*i 的大作中提到】
: There's no such thing as a FP programmer who does not know how to program in
: Java if they need to. If they can make a good living without doing that,
: why should they. After all, a Java programmer is like a janitor these days,
: it's a replaceable commodity because every one can do it.
: Truth hurts.
:
: FP
: cares.
: keen
: The

g*****g
发帖数: 34805
418
There's no such things as all things being equal. When people start marking
themselves "FP programmers" for self-claimed superiority while not holding
such a a job, it's like one boasting his dragon killing skills.
Normal people would be proud of what they do and do well, not what they don'
t do but they could do. I see severe confidence lacking here.

FP
do
normally

【在 h*i 的大作中提到】
: There isn't a line, but "FP programmers" are those programmers who can do FP
: , "non-FP programmers" are those who cannot. Because all programmers can do
: non-FP, and only "FP programmers" can do FP, "FP programmers" are normally
: considered better programmers, everything else being equal.
:
: s

c*******9
发帖数: 9032
419
牛。你通过什么样的渠道卖的?

【在 a*****e 的大作中提到】
: LOL, 这是要比谁最先搞 java 吗?我 97 年写的 Java 程序后来卖给Yahoo和华渊网。
: 后来再也没碰过 Java,所以 J2EE 这些我完全没接触过,不敢再古德霸面前抖啊,哈
: 哈哈

c*******9
发帖数: 9032
420
你说的没错,我以前的同事中,会FP的java programmer明显水平比不会的高很多。

personal

【在 b***e 的大作中提到】
: I didn't get it where my logic is twisted. Therefore I prefer to question
: your skills of reading comprehension. Nonetheless, with my limited personal
: experience, I do observe average FP developers exhibiting much more
: superior smartness and capability over Java developers (I did work in both
: contexts for non-trivial/significant time). Also, to my observation FP
: developers are either making more of a fortune or getting a better social
: status than mere Java developers.
:
: prove
: is

相关主题
大牛给讲讲monad吧?OOP里面的Object其实是actor
functional programming 哪本书经典适合入门怎么这里这么多人学python
也谈OOP跟FP之争粉FP的人是因为把电脑想象成图灵机了
进入Programming版参与讨论
c*******9
发帖数: 9032
421
你说的没错,我以前的同事中,会FP(比如scheme)的java programmer明显水平比不
会的高很多。

personal

【在 b***e 的大作中提到】
: I didn't get it where my logic is twisted. Therefore I prefer to question
: your skills of reading comprehension. Nonetheless, with my limited personal
: experience, I do observe average FP developers exhibiting much more
: superior smartness and capability over Java developers (I did work in both
: contexts for non-trivial/significant time). Also, to my observation FP
: developers are either making more of a fortune or getting a better social
: status than mere Java developers.
:
: prove
: is

c*******9
发帖数: 9032
422
说得好。人不能和猪一样,要有点更高的追求。

me
how

【在 b***e 的大作中提到】
: I question the accuracy of the Haskell developer salary report, well, yes,
: depending on how do you classify Haskell developers. Most of the Haskell
: developers are truly academic researchers. Those people who worked with me
: before are mostly tenure professors at some universities. So far I didn't
: find a single case in my list of 4 big cows who's "thousand years of post-
: doc". This is not biology (sorry for my candor, biologists). They might
: not be making as high as 200k per year as far as base salary is concerned,
: but undeniably, they are at a higher social status and earn more
: professional respects than mere Java developers. Their contribution to
: science and to the development of human society is not measured through how

z****e
发帖数: 54598
423
追求不在语言这种层面上啊
谁没事老倒腾这种东西
就一工具
利用工具去实现什么
那才是真正的追求

【在 c*******9 的大作中提到】
: 说得好。人不能和猪一样,要有点更高的追求。
:
: me
: how

c*******9
发帖数: 9032
424
没错。认识一些java或c++ programmer认识到java或c++的不足才去学functional
programming。

programming
because
various
who

【在 n******t 的大作中提到】
: But not many people make money directly from knowing functional programming
: language. On the other hand, I think any job,that pays your directly because
: you are using a particular language, is not so good as a job. It can give
: you are decent life maybe, but might be not all that interesting.
: Knowing a language that is not popular in industry and still learning or
: even mastering it, could be an evidence the learner is interested in various
: programming aspects and are probably more skillful than the normal
: "learn-something-to-get-a-job" type of programmer. Very few programmers who
: know FP just know FP. Most of them knows enough C/C++/Java before that and
: they are probably going to learn a lot more in the future. So in this

g*****g
发帖数: 34805
425
弄半天还停留语言层次上呢,我说了平台之争说了多少年,说了前端风水轮流转,后端
jvm 独大。争来争去还不是拾我牙慧。要装逼也要点 track record吧。

【在 c*******9 的大作中提到】
: 没错。认识一些java或c++ programmer认识到java或c++的不足才去学functional
: programming。
:
: programming
: because
: various
: who

c*******9
发帖数: 9032
426
这里是Programming版,也就谈语言了。
从一个小的方面的讨论可以看出一个人在其他方面的思维方式。支持FP的多数是比较理
想主义。
支持流行语言的多数是比较现实主义。持哪种主义在生存发展上站优势不好说,似乎现
实主义者大多适合当manager,理想主义者大多适合学术和艺术,但最伟大的manager像
jobs还是理想主义者。从我对周围人的观察来看,理想主义者虽然会在不完美的现实中
会更多碰壁,但内心往往更宁静快乐。
再说“实现什么”,一些FP的支持者也是因为自己要实现的东西用非FP实现不方便,才
去花时间精力去学习FP。

【在 z****e 的大作中提到】
: 追求不在语言这种层面上啊
: 谁没事老倒腾这种东西
: 就一工具
: 利用工具去实现什么
: 那才是真正的追求

c*******9
发帖数: 9032
427
语言层次说大可大,说小可小。这里讨论要什么track record是没意思的,又不是找人
要投资。
bill gate,jobs成功前能有多少 值得track record的东西,如果不是事后诸葛的话。

【在 g*****g 的大作中提到】
: 弄半天还停留语言层次上呢,我说了平台之争说了多少年,说了前端风水轮流转,后端
: jvm 独大。争来争去还不是拾我牙慧。要装逼也要点 track record吧。

g*****g
发帖数: 34805
428
不懂是小事,非要不懂装懂闹笑话,就不要怪我打脸。鼓吹 fp 的没几年就有一拨,吹
来吹去除了现在能在 jvm 上跑了,也没看出什么大的进步。

【在 c*******9 的大作中提到】
: 语言层次说大可大,说小可小。这里讨论要什么track record是没意思的,又不是找人
: 要投资。
: bill gate,jobs成功前能有多少 值得track record的东西,如果不是事后诸葛的话。

c*******9
发帖数: 9032
429
这有谁不懂装懂?讨论中有些细节错误难免。有什么打脸不打脸了的,多知道些细节就
很牛逼了?

【在 g*****g 的大作中提到】
: 不懂是小事,非要不懂装懂闹笑话,就不要怪我打脸。鼓吹 fp 的没几年就有一拨,吹
: 来吹去除了现在能在 jvm 上跑了,也没看出什么大的进步。

g*****g
发帖数: 34805
430
还是那句话,说啥都行,愿意闹笑话也由你。事实胜于雄辩。fp 程序员明明都快饿死
了,还成天以更好的程序员自居,莫非是精神胜利发法?

【在 c*******9 的大作中提到】
: 这有谁不懂装懂?讨论中有些细节错误难免。有什么打脸不打脸了的,多知道些细节就
: 很牛逼了?

相关主题
学FP不是为了写代码, 而是为了优秀的架构.FP更接近人的思维
go几天的一些感受有没有喜欢haskell的同学
Haskell很难学。。对 (im)mutability 的误解和深度理解
进入Programming版参与讨论
c*******9
发帖数: 9032
431
我不道说什么了让您奸笑了。我说过仅仅通过我的观察的一些观点。你如果什么都要所
谓统计支持才可信,
我也想要个统计支持说明你不是发帖机器人,见到支持FP的就自动发帖反对。你说的
java在业界流行,我一点都不反对,
那是显而易见的事实,反复说就是bullshit,没一点有价值的信息。

【在 g*****g 的大作中提到】
: 还是那句话,说啥都行,愿意闹笑话也由你。事实胜于雄辩。fp 程序员明明都快饿死
: 了,还成天以更好的程序员自居,莫非是精神胜利发法?

g*****g
发帖数: 34805
432
这个bbs上最不靠谱的例子就是四大牛人了,你是新警察吧。我老看不惯的就是几个装B
的半吊子程序员,学了点屠龙技,就自以为比别人牛逼,成天来踩俺们java 码农。
真让拿点统计,立刻尿了。
我老熟悉大量 java轮子,论实用无出其右。结果使出来还要被鄙视是拼凑方案。倒是
什么fp 屠龙技,没几个真工作里用过,偏偏成天有捧臭脚的。板上装B之风可以休矣。

【在 c*******9 的大作中提到】
: 我不道说什么了让您奸笑了。我说过仅仅通过我的观察的一些观点。你如果什么都要所
: 谓统计支持才可信,
: 我也想要个统计支持说明你不是发帖机器人,见到支持FP的就自动发帖反对。你说的
: java在业界流行,我一点都不反对,
: 那是显而易见的事实,反复说就是bullshit,没一点有价值的信息。

c*******9
发帖数: 9032
433
他们什么水平我不了解,和你比哪个更牛逼我也不关心。装B不装B更不是我关心的事,
装B可以说是人的本性,也可以说是一种本能。我关心的是论点是否informative,让我
长些见识,而不是每次都说些老生常谈的东西。

装B

【在 g*****g 的大作中提到】
: 这个bbs上最不靠谱的例子就是四大牛人了,你是新警察吧。我老看不惯的就是几个装B
: 的半吊子程序员,学了点屠龙技,就自以为比别人牛逼,成天来踩俺们java 码农。
: 真让拿点统计,立刻尿了。
: 我老熟悉大量 java轮子,论实用无出其右。结果使出来还要被鄙视是拼凑方案。倒是
: 什么fp 屠龙技,没几个真工作里用过,偏偏成天有捧臭脚的。板上装B之风可以休矣。

q*c
发帖数: 9453
434
儿皇帝能当皇帝是因为爹牛。js 就是运气好认了 开国皇帝 netscape 当爹。
对比 java 那是千军万马杀出来自己开国当皇帝,完全没有可比性。

【在 x****u 的大作中提到】
: 所以说JavaScript也能长盛不衰,主要是特定场合有特定用处。
b***e
发帖数: 1419
435
这个不好说是认的吧,应该说是亲生的。

【在 q*c 的大作中提到】
: 儿皇帝能当皇帝是因为爹牛。js 就是运气好认了 开国皇帝 netscape 当爹。
: 对比 java 那是千军万马杀出来自己开国当皇帝,完全没有可比性。

q*c
发帖数: 9453
436
总有时间比钱多的愣头青说:用最合适的语言解决某个问题。
问题是熟悉工具本身就是问题的一部分,甚至是大部分。

【在 d**********x 的大作中提到】
: 人总是在遇到问题的时候才想起来前人总结的经验。。。
: 编译原理一上来就说了语言的第一大concern就是learning cost...
:
: the

q*c
发帖数: 9453
437
30 个 bad fp 就能把你干的死定。
只要多来几个匿名函数嵌套回调, 夹杂着 implicit parameter conversion,,就能让
你的大脑 stack overflow.

why

【在 g*****g 的大作中提到】
: I am not against anyone using FP in a niche domain. I am merely talking why
: existing FPs won't see massive adoption as a general purpose language.
: I tend to quantify the success of the language to the values of projects
: built on top of it. To that extent, the success of the language is also
: largely correlated to its popularity.
: At the end of the day, 3000 bad Java developers are still manageable. I
: doubt you want to work with 3000 bad FP developers at all. Exactly one of
: the reason FP is not going anywhere.

q*c
发帖数: 9453
438
you can live till death with some cancer.
you can barely see next month sunlight with other cancer..
不同的癌症,效果是天地的差别。混淆程度是不对的。

developers,

【在 s***o 的大作中提到】
: I agree with most of you points.
: but the last one just has no base at all. bad developers are bad developers,
: they are cancer no matter what language they use.
:
: why

c*******9
发帖数: 9032
439
fp 程序员明明都快饿死了?这个没听说。
fp 程序员少不能说都快饿死吧,就像CEO少,不能说CEO说都快饿死了。当然CEO自己这
么说也对。。。。

【在 g*****g 的大作中提到】
: 还是那句话,说啥都行,愿意闹笑话也由你。事实胜于雄辩。fp 程序员明明都快饿死
: 了,还成天以更好的程序员自居,莫非是精神胜利发法?

n****1
发帖数: 1136
440
他没用考虑一众excel程序猿,人赚得可不少。

【在 c*******9 的大作中提到】
: fp 程序员明明都快饿死了?这个没听说。
: fp 程序员少不能说都快饿死吧,就像CEO少,不能说CEO说都快饿死了。当然CEO自己这
: 么说也对。。。。

相关主题
对 (im)mutability 的误解和深度理解模板算是纯FP吗
王垠新文 为Java说句公道话批判 go
我对为什么使用FP的理解 (补)1st class citizen
进入Programming版参与讨论
c*******9
发帖数: 9032
441
jobs “stay hungry”, 明显就是饿死的。。。。

【在 c*******9 的大作中提到】
: fp 程序员明明都快饿死了?这个没听说。
: fp 程序员少不能说都快饿死吧,就像CEO少,不能说CEO说都快饿死了。当然CEO自己这
: 么说也对。。。。

q*c
发帖数: 9453
442
总长见识可不一定是好事。
good stuff many times are boring.

【在 c*******9 的大作中提到】
: 他们什么水平我不了解,和你比哪个更牛逼我也不关心。装B不装B更不是我关心的事,
: 装B可以说是人的本性,也可以说是一种本能。我关心的是论点是否informative,让我
: 长些见识,而不是每次都说些老生常谈的东西。
:
: 装B

m******t
发帖数: 635
443
excel算FP,是指excel本身,还是指VBA?给展开说说吧

【在 n****1 的大作中提到】
: 他没用考虑一众excel程序猿,人赚得可不少。
n****1
发帖数: 1136
444
VBA或者excel自带的那些函数, 我在这个帖子里说了:
http://www.mitbbs.com/article/Programming/31293257_0.html

【在 m******t 的大作中提到】
: excel算FP,是指excel本身,还是指VBA?给展开说说吧
g*****g
发帖数: 34805
445
表上带几个函数就FP了?I 服了U。

【在 n****1 的大作中提到】
: VBA或者excel自带的那些函数, 我在这个帖子里说了:
: http://www.mitbbs.com/article/Programming/31293257_0.html

n*w
发帖数: 3393
446
excel本身,很早以前看到过有人这么说。
google到这个
“While most people don't call it programming, technically excel
spreadsheets comprise a functional programming language, and like most
functional programming languages, it excels (pun intended) at numerical
calculations. Each cell contains a constant or a formula, which is a pure
function since it has no side effects. Whenever a cell is changed, the "
program" executes. Selection is done via functions like IF or HLOOKUP.
Sequence is determined by formula dependencies, and "iteration" is done via
a fill.”
http://programmers.stackexchange.com/questions/125990/questions

【在 m******t 的大作中提到】
: excel算FP,是指excel本身,还是指VBA?给展开说说吧
f******x
发帖数: 98
447
It's meaningless to invoke tenure, years of experience, market dominance or
salary in a discussion about technologies. The world is never short of
examples of stupid but highly paid people, or stupid but commercially
successful products. Commercial success does not necessarily mean
technological superiority, similarly the programmer's salary is just a
reflection of market supply and demand, nothing more. Invoking tenure or
salary is the quickest and surest way to degenerate an otherwise informative
discussion in to inflammatory nonsense.
To share some of my own experience, I have been programming C++/java/python
for a long time, and I recently learned Clojure on my own out of curiosity.
I did experience the "profound enlightening experience" that is best
summarized by Eric Raymond: "Lisp is worth learning for the profound
enlightenment experience you will have when you finally get it; that
experience will make you a better programmer for the rest of your days, even
if you never actually use Lisp itself a lot."
I may never got to use Clojure in my work, but there is no doubt that
learning Clojure made me a much much better programmer. My team primarily
uses Python, I would hire a programmer who is fluent in Clojure (or other FP
like Lisp/Haskell) in a heart beat over a C++/java/Python only programmer,
even if all he will be doing in the team is Python.
t****a
发帖数: 1212
448
excel还真是有FP的味道,而且还挺高级的叫做reactive functional programming。本
质上是一个会自动触发的计算workflow。
javalin这个clojure library就在模仿excel的计算概念:
https://github.com/tailrecursion/javelin

【在 g*****g 的大作中提到】
: 表上带几个函数就FP了?I 服了U。
t****a
发帖数: 1212
449
谢谢分享,我也有相同的体会。

or
informative
python
.

【在 f******x 的大作中提到】
: It's meaningless to invoke tenure, years of experience, market dominance or
: salary in a discussion about technologies. The world is never short of
: examples of stupid but highly paid people, or stupid but commercially
: successful products. Commercial success does not necessarily mean
: technological superiority, similarly the programmer's salary is just a
: reflection of market supply and demand, nothing more. Invoking tenure or
: salary is the quickest and surest way to degenerate an otherwise informative
: discussion in to inflammatory nonsense.
: To share some of my own experience, I have been programming C++/java/python
: for a long time, and I recently learned Clojure on my own out of curiosity.

p*****2
发帖数: 21240
450

or
informative
python
.
顶大牛。看来学习Clojure才是王道。

【在 f******x 的大作中提到】
: It's meaningless to invoke tenure, years of experience, market dominance or
: salary in a discussion about technologies. The world is never short of
: examples of stupid but highly paid people, or stupid but commercially
: successful products. Commercial success does not necessarily mean
: technological superiority, similarly the programmer's salary is just a
: reflection of market supply and demand, nothing more. Invoking tenure or
: salary is the quickest and surest way to degenerate an otherwise informative
: discussion in to inflammatory nonsense.
: To share some of my own experience, I have been programming C++/java/python
: for a long time, and I recently learned Clojure on my own out of curiosity.

1 (共1页)
进入Programming版参与讨论
相关主题
怎么这里这么多人学python王垠新文 为Java说句公道话
粉FP的人是因为把电脑想象成图灵机了我对为什么使用FP的理解 (补)
学FP不是为了写代码, 而是为了优秀的架构.模板算是纯FP吗
go几天的一些感受批判 go
Haskell很难学。。1st class citizen
FP更接近人的思维我还是认为scala的程序员水平高
有没有喜欢haskell的同学clojure这语言真不错
对 (im)mutability 的误解和深度理解大牛给讲讲monad吧?
相关话题的讨论汇总
话题: fp话题: java话题: haskell话题: functional话题: language