2006年01月11日 星期三 07:48
一直都用管道,所以从来没觉得函数式编程有什么很了不起的 就跟一条流水线一样,一头放数据,一头出产品,很正常的过程,搞不懂为什么这么多大牛对函数式编程这么推崇 有哪位对functional programming比较熟的,希望能写点东西介绍一下
2006年01月11日 星期三 07:59
在 06-1-11,shhgs<shhgs.efhilt at gmail.com> 写道: > 一直都用管道,所以从来没觉得函数式编程有什么很了不起的 > > 就跟一条流水线一样,一头放数据,一头出产品,很正常的过程,搞不懂为什么这么多大牛对函数式编程这么推崇 > > 有哪位对functional programming比较熟的,希望能写点东西介绍一下 > http://wiki.woodpecker.org.cn/moin/fp4python > _______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > -- # Time is unimportant, only life important! ## 面朝开源,我心自由!
2006年01月11日 星期三 08:05
Zoom,我不是Python的新人,其实这些东西我都知道,甚至准备一下我也能写。 我是想知道,fp为什么对程序员来说这么有吸引力。我几乎一眼就认定,fp就是管道,就是流水线。很正常的东西,不应该让这么多牛人激动。我想知道他们激动些什么。 On 1/10/06, Zoom Quiet <zoom.quiet at gmail.com> wrote: > 在 06-1-11,shhgs<shhgs.efhilt at gmail.com> 写道: > > 一直都用管道,所以从来没觉得函数式编程有什么很了不起的 > > > > 就跟一条流水线一样,一头放数据,一头出产品,很正常的过程,搞不懂为什么这么多大牛对函数式编程这么推崇 > > > > 有哪位对functional programming比较熟的,希望能写点东西介绍一下 > > > http://wiki.woodpecker.org.cn/moin/fp4python > > _______________________________________________ > > python-chinese > > Post: send python-chinese at lists.python.cn > > Subscribe: send subscribe to python-chinese-request at lists.python.cn > > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > > > -- > # Time is unimportant, only life important! > ## 面朝开源,我心自由! > > _______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese > >
2006年01月11日 星期三 08:18
看了http://wiki.woodpecker.org.cn/moin/FunctionProgramAbt 好像比想的稍好一点,就是可以在设计流水线的时候用generic的函数,然后定义的时候具体指明函数。 我觉得具体的思路就是铺设一条流水线,一头投入原料,一头拿产品 On 1/10/06, shhgs <shhgs.efhilt at gmail.com> wrote: > Zoom,我不是Python的新人,其实这些东西我都知道,甚至准备一下我也能写。 > > 我是想知道,fp为什么对程序员来说这么有吸引力。我几乎一眼就认定,fp就是管道,就是流水线。很正常的东西,不应该让这么多牛人激动。我想知道他们激动些什么。 > > > > On 1/10/06, Zoom Quiet <zoom.quiet at gmail.com> wrote: > > 在 06-1-11,shhgs<shhgs.efhilt at gmail.com> 写道: > > > 一直都用管道,所以从来没觉得函数式编程有什么很了不起的 > > > > > > 就跟一条流水线一样,一头放数据,一头出产品,很正常的过程,搞不懂为什么这么多大牛对函数式编程这么推崇 > > > > > > 有哪位对functional programming比较熟的,希望能写点东西介绍一下 > > > > > http://wiki.woodpecker.org.cn/moin/fp4python > > > _______________________________________________ > > > python-chinese > > > Post: send python-chinese at lists.python.cn > > > Subscribe: send subscribe to python-chinese-request at lists.python.cn > > > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > > > -- > > # Time is unimportant, only life important! > > ## 面朝开源,我心自由! > > > > _______________________________________________ > > python-chinese > > Post: send python-chinese at lists.python.cn > > Subscribe: send subscribe to python-chinese-request at lists.python.cn > > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > >
2006年01月11日 星期三 08:36
数据结构与行为的正交化分离,这在设计方法上较之传统的OO是一次螺旋式的上升。 当然,有反璞归真的思想未必是坏事,shhgs的流水线理解举重若轻,佩服佩服。 回想起来,和朋友在JavaScript领域的指点颇有异曲同工之妙。 在06-1-11,shhgs <shhgs.efhilt at gmail.com> 写道: > > 看了http://wiki.woodpecker.org.cn/moin/FunctionProgramAbt > > 好像比想的稍好一点,就是可以在设计流水线的时候用generic的函数,然后定义的时候具体指明函数。 > > 我觉得具体的思路就是铺设一条流水线,一头投入原料,一头拿产品 > > > On 1/10/06, shhgs <shhgs.efhilt at gmail.com> wrote: > > Zoom,我不是Python的新人,其实这些东西我都知道,甚至准备一下我也能写。 > > > > > 我是想知道,fp为什么对程序员来说这么有吸引力。我几乎一眼就认定,fp就是管道,就是流水线。很正常的东西,不应该让这么多牛人激动。我想知道他们激动些什么。 > > > > > > > > On 1/10/06, Zoom Quiet <zoom.quiet at gmail.com> wrote: > > > 在 06-1-11,shhgs<shhgs.efhilt at gmail.com> 写道: > > > > 一直都用管道,所以从来没觉得函数式编程有什么很了不起的 > > > > > > > > 就跟一条流水线一样,一头放数据,一头出产品,很正常的过程,搞不懂为什么这么多大牛对函数式编程这么推崇 > > > > > > > > 有哪位对functional programming比较熟的,希望能写点东西介绍一下 > > > > > > > http://wiki.woodpecker.org.cn/moin/fp4python > > > > _______________________________________________ > > > > python-chinese > > > > Post: send python-chinese at lists.python.cn > > > > Subscribe: send subscribe to python-chinese-request at lists.python.cn > > > > Unsubscribe: send unsubscribe to > python-chinese-request at lists.python.cn > > > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > > > > > > > > -- > > > # Time is unimportant, only life important! > > > ## 面朝开源,我心自由! > > > > > > _______________________________________________ > > > python-chinese > > > Post: send python-chinese at lists.python.cn > > > Subscribe: send subscribe to python-chinese-request at lists.python.cn > > > Unsubscribe: send unsubscribe to > python-chinese-request at lists.python.cn > > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > _______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > -- 欢迎访问: http://blog.csdn.net/ccat 刘鑫 March.Liu -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060111/e2a7fb11/attachment.htm
2006年01月11日 星期三 09:22
在 06-1-11,shhgs<shhgs.efhilt at gmail.com> 写道: > Zoom,我不是Python的新人,其实这些东西我都知道,甚至准备一下我也能写。 > > 我是想知道,fp为什么对程序员来说这么有吸引力。我几乎一眼就认定,fp就是管道,就是流水线。很正常的东西,不应该让这么多牛人激动。我想知道他们激动些什么。 > > 咳咳咳,冒失了, 其实,FP 与流行的OOP什么的编程思想有本质的不同, 更加象Lisp 那样儿的纯逻辑组织,即当初计算机科学的两大分支? 图灵和冯·诺依曼? FP 强迫人象计算机那样思考, OOP AOP。。强迫计算机象人一样思考? > > On 1/10/06, Zoom Quiet <zoom.quiet at gmail.com> wrote: > > 在 06-1-11,shhgs<shhgs.efhilt at gmail.com> 写道: > > > 一直都用管道,所以从来没觉得函数式编程有什么很了不起的 > > > > > > 就跟一条流水线一样,一头放数据,一头出产品,很正常的过程,搞不懂为什么这么多大牛对函数式编程这么推崇 > > > > > > 有哪位对functional programming比较熟的,希望能写点东西介绍一下 > > > > > http://wiki.woodpecker.org.cn/moin/fp4python > > > _______________________________________________ > > > python-chinese > > > Post: send python-chinese at lists.python.cn > > > Subscribe: send subscribe to python-chinese-request at lists.python.cn > > > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > > > -- > > # Time is unimportant, only life important! > > ## 面朝开源,我心自由! > > > > _______________________________________________ > > python-chinese > > Post: send python-chinese at lists.python.cn > > Subscribe: send subscribe to python-chinese-request at lists.python.cn > > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > > _______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > -- # Time is unimportant, only life important! ## 面朝开源,我心自由!
2006年01月11日 星期三 09:48
http://www.haskell.org/ 2006/1/11, Zoom Quiet <zoom.quiet at gmail.com>: > 在 06-1-11,shhgs<shhgs.efhilt at gmail.com> 写道: > > Zoom,我不是Python的新人,其实这些东西我都知道,甚至准备一下我也能写。 > > > > 我是想知道,fp为什么对程序员来说这么有吸引力。我几乎一眼就认定,fp就是管道,就是流水线。很正常的东西,不应该让这么多牛人激动。我想知道他们激动些什么。 > > > > > 咳咳咳,冒失了, > 其实,FP 与流行的OOP什么的编程思想有本质的不同, > 更加象Lisp 那样儿的纯逻辑组织,即当初计算机科学的两大分支? > 图灵和冯・诺依曼? > FP 强迫人象计算机那样思考, > OOP AOP。。强迫计算机象人一样思考? > > > > > On 1/10/06, Zoom Quiet <zoom.quiet at gmail.com> wrote: > > > 在 06-1-11,shhgs<shhgs.efhilt at gmail.com> 写道: > > > > 一直都用管道,所以从来没觉得函数式编程有什么很了不起的 > > > > > > > > 就跟一条流水线一样,一头放数据,一头出产品,很正常的过程,搞不懂为什么这么多大牛对函数式编程这么推崇 > > > > > > > > 有哪位对functional programming比较熟的,希望能写点东西介绍一下 > > > > > > > http://wiki.woodpecker.org.cn/moin/fp4python > > > > _______________________________________________ > > > > python-chinese > > > > Post: send python-chinese at lists.python.cn > > > > Subscribe: send subscribe to python-chinese-request at lists.python.cn > > > > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > > > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > > > > > > > > -- > > > # Time is unimportant, only life important! > > > ## 面朝开源,我心自由! > > > > > > _______________________________________________ > > > python-chinese > > > Post: send python-chinese at lists.python.cn > > > Subscribe: send subscribe to python-chinese-request at lists.python.cn > > > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > _______________________________________________ > > python-chinese > > Post: send python-chinese at lists.python.cn > > Subscribe: send subscribe to python-chinese-request at lists.python.cn > > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > > > -- > # Time is unimportant, only life important! > ## 面朝开源,我心自由! > > _______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese > >
2006年01月11日 星期三 09:58
一点浅见 觉得以前结构化的是比较接近 风落易满体系结构的计算机的方法 oop是用来模拟人类思维解决问题的方法 而fp 是从形式化的数学发展来的 以基本的运算+递归完成所有可计算问题 比较方便程序自动证明 在具体开发中我想在宏观上用oop建摸 具体算法可以用结构化或fp编写 大家怎么想? 我不过是个菜鸟 在06-1-11,xxmplus <xxmplus at gmail.com> 写道: > > http://www.haskell.org/ > > 2006/1/11, Zoom Quiet <zoom.quiet at gmail.com>: > > 在 06-1-11,shhgs<shhgs.efhilt at gmail.com> 写道: > > > Zoom,我不是Python的新人,其实这些东西我都知道,甚至准备一下我也能写。 > > > > > > > 我是想知道,fp为什么对程序员来说这么有吸引力。我几乎一眼就认定,fp就是管道,就是流水线。很正常的东西,不应该让这么多牛人激动。我想知道他们激动些什么。 > > > > > > > > 咳咳咳,冒失了, > > 其实,FP 与流行的OOP什么的编程思想有本质的不同, > > 更加象Lisp 那样儿的纯逻辑组织,即当初计算机科学的两大分支? > > 图灵和冯・诺依曼? > > FP 强迫人象计算机那样思考, > > OOP AOP。。强迫计算机象人一样思考? > > > > > > > > On 1/10/06, Zoom Quiet <zoom.quiet at gmail.com> wrote: > > > > 在 06-1-11,shhgs<shhgs.efhilt at gmail.com> 写道: > > > > > 一直都用管道,所以从来没觉得函数式编程有什么很了不起的 > > > > > > > > > > 就跟一条流水线一样,一头放数据,一头出产品,很正常的过程,搞不懂为什么这么多大牛对函数式编程这么推崇 > > > > > > > > > > 有哪位对functional programming比较熟的,希望能写点东西介绍一下 > > > > > > > > > http://wiki.woodpecker.org.cn/moin/fp4python > > > > > _______________________________________________ > > > > > python-chinese > > > > > Post: send python-chinese at lists.python.cn > > > > > Subscribe: send subscribe to > python-chinese-request at lists.python.cn > > > > > Unsubscribe: send unsubscribe to > python-chinese-request at lists.python.cn > > > > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > > > > > > > > > > > > > -- > > > > # Time is unimportant, only life important! > > > > ## 面朝开源,我心自由! > > > > > > > > _______________________________________________ > > > > python-chinese > > > > Post: send python-chinese at lists.python.cn > > > > Subscribe: send subscribe to python-chinese-request at lists.python.cn > > > > Unsubscribe: send unsubscribe to > python-chinese-request at lists.python.cn > > > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > > > > > _______________________________________________ > > > python-chinese > > > Post: send python-chinese at lists.python.cn > > > Subscribe: send subscribe to python-chinese-request at lists.python.cn > > > Unsubscribe: send unsubscribe to > python-chinese-request at lists.python.cn > > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > > > -- > > # Time is unimportant, only life important! > > ## 面朝开源,我心自由! > > > > _______________________________________________ > > python-chinese > > Post: send python-chinese at lists.python.cn > > Subscribe: send subscribe to python-chinese-request at lists.python.cn > > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > > _______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > -- http://codeplayer.blogbus.com">我的博客 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060111/5c0480b9/attachment.htm
2006年01月11日 星期三 10:24
On 三, 2006-01-11 at 09:22 +0800, Zoom Quiet wrote: > 在 06-1-11,shhgs<shhgs.efhilt at gmail.com> 写道: > > Zoom,我不是Python的新人,其实这些东西我都知道,甚至准备一下我也能写。 > > > > 我是想知道,fp为什么对程序员来说这么有吸引力。我几乎一眼就认定,fp就是管道,就是流水线。很正常的东西,不应该让这么多牛人激动。我想知道他们激动些什么。 > > > > > 咳咳咳,冒失了, > 其实,FP 与流行的OOP什么的编程思想有本质的不同, > 更加象Lisp 那样儿的纯逻辑组织,即当初计算机科学的两大分支? > 图灵和冯·诺依曼? > FP 强迫人象计算机那样思考, > OOP AOP。。强迫计算机象人一样思考? > > > > > On 1/10/06, Zoom Quiet <zoom.quiet at gmail.com> wrote: > > > 在 06-1-11,shhgs<shhgs.efhilt at gmail.com> 写道: > > > > 一直都用管道,所以从来没觉得函数式编程有什么很了不起的 > > > > > > > > 就跟一条流水线一样,一头放数据,一头出产品,很正常的过程,搞不懂为什么这么多大牛对函数式编程这么推崇 > > > > > > > > 有哪位对functional programming比较熟的,希望能写点东西介绍一下 > > > > > > > http://wiki.woodpecker.org.cn/moin/fp4python 两位先生的理解有所偏差, 函数式是和过程式相对的概念. 过程式比较接近计算机 的工作方式, 而函数式才是接近人(实际是数学家)的思维方式,离计算机比较远. 看看下面haskell和c写的quick sort程序, haskell版本实际上是在写该算法的数 学公式, 而c则是在写具体的计算过程. 请读这里: 摘自 http://www.haskell.org/aboutHaskell.html What is functional programming? C, Java, Pascal, Ada, and so on, are all imperative languages. They are "imperative" in the sense that they consist of a sequence of commands, which are executed strictly one after the other. Haskell is a functional language. A functional program is a single expression, which is executed by evaluating the expression. Anyone who has used a spreadsheet has experience of functional programming. In a spreadsheet, one specifies the value of each cell in terms of the values of other cells. The focus is on what is to be computed, not how it should be computed. For example: * we do not specify the order in which the cells should be calculated - instead we take it for granted that the spreadsheet will compute cells in an order which respects their dependencies. * we do not tell the spreadsheet how to allocate its memory - rather, we expect it to present us with an apparently infinite plane of cells, and to allocate memory only to those cells which are actually in use. * for the most part, we specify the value of a cell by an expression (whose parts can be evaluated in any order), rather by a sequence of commands which computes its value. An interesting consequence of the spreadsheet's unspecified order of re-calculation is that the notion of assignment is not very useful. After all, if you don't know exactly when an assignment will happen, you can't make much use of it! This contrasts strongly with programs in conventional languages like C, which consist essentially of a carefully-specified sequence of assignments, or Java, in which the ordering of method calls is crucial to the meaning of a program. This focus on the high-level "what" rather than the low-level "how" is a distinguishing characteristic of functional programming languages. Another well-known nearly-functional language is the standard database query language SQL. An SQL query is an expression involving projections, selections, joins and so forth. The query says what relation should be computed, without saying how it should be computed. Indeed, the query can be evaluated in any convenient order. SQL implementations often perform extensive query optimisation which (among other things) figures out the best order in which to evaluate the expression. Quicksort in Haskell qsort [] = [] qsort (x:xs) = qsort elts_lt_x ++ [x] ++ qsort elts_greq_x where elts_lt_x = [y | y <- xs, y < x] elts_greq_x = [y | y <- xs, y >= x] Quicksort in C qsort( a, lo, hi ) int a[], hi, lo; { int h, l, p, t; if (lo < hi) { l = lo; h = hi; p = a[hi]; do { while ((l < h) && (a[l] <= p)) l = l+1; while ((h > l) && (a[h] >= p)) h = h-1; if (l < h) { t = a[l]; a[l] = a[h]; a[h] = t; } } while (l < h); t = a[l]; a[l] = a[hi]; a[hi] = t; qsort( a, lo, l-1 ); qsort( a, l+1, hi ); } }
Zeuux © 2025
京ICP备05028076号