上一页 1 ··· 39 40 41 42 43 44 45 46 47 ··· 53 下一页

Python Decorator Closure

摘要: http://www.cnblogs.com/tqsummer/archive/2011/01/24/1943314.html, Python和Decorator(装饰器)模式 http://www.cnblogs.com/huxi/archive/2011/03/01/1967600.html, Python装饰器与面向切面编程 最近在看FP相关, 看到Closure, 想起这个... pyth... 阅读全文
posted @ 2013-02-08 15:49 fxjwind 阅读(461) 评论(0) 推荐(0) 编辑

Python yield generator

摘要: http://www.ibm.com/developerworks/cn/opensource/os-cn-python-yield/, Python yield 使用浅析 这篇说的很清楚 主要看到FP里面的Lazy Seq概念, 所以想起这个... 包含yield函数就是生成器(generator) 什么是生成器, 用于产生迭代器(iterator), 有什么用? 在pyth... 阅读全文
posted @ 2013-02-08 13:54 fxjwind 阅读(322) 评论(0) 推荐(0) 编辑

Programming clojure – Recursion and Lazy-seq

摘要: 5.1 Functional Programming Concepts The Six Rules Although the benefits of FP are compelling, FP is a wholesale change from the imperative programming style that dominates much of the programmin... 阅读全文
posted @ 2013-02-07 18:20 fxjwind 阅读(531) 评论(0) 推荐(0) 编辑

Practical Clojure - Functional Programming Techniques

摘要: 对于通用FP技术的介绍, 参考FP基础此处主要描述这些FP技术特性, 在clojure中的实现First-Class Functions, 一类公民Function作为FP中最基本的元素, 是构成所有其他的基石, 所以是一类公民...什么是first-class?It can be created on demand. It can be stored in a data structure. It can be passed as an argument to a function. It can be returned as the value of a funct... 阅读全文
posted @ 2013-02-07 18:18 fxjwind 阅读(328) 评论(0) 推荐(0) 编辑

Design Pattern - 装饰模式

摘要: 装饰模式 动态 地给一个对象 添加一些额外的职责 。就增加功能来说,Decorator模式相比生成子类更为灵活。 对于对象功能的扩展, 面向对象一般通过继承来解决, 但这种方式缺乏灵活性, 而且随意定义子类容易导致类层次结构过快膨胀. 场景, 当类的核心职责和主要行为没有发生变化, 仅仅需要动态对类对象添加一些装饰性的功能, 比如给人穿衣服...... 如下图所示, 只是... 阅读全文
posted @ 2013-02-05 16:47 fxjwind 阅读(333) 评论(0) 推荐(0) 编辑

Design Pattern - 工厂模式

摘要: 本质上而言, 这种模式就是用类来封装和拆分条件分支(if else, switch case), 带来的问题就是其实用类封装也是很麻烦的. 其实对于更高级的语言, 如动态语言python(通过eval, 如下例), 或FP语言(通过pattern match), 这种模式根本就没有存在的价值. 工厂模式概述 工厂模式, 包括简单工厂, 工厂方法, 抽象工厂, 为什么叫工厂, 因为工... 阅读全文
posted @ 2013-02-05 16:37 fxjwind 阅读(302) 评论(0) 推荐(0) 编辑

Design Pattern - 7原则

摘要: 很多程序员用面向对象语言写了多年的代码, 仍然不知道设计模式为何物, 这不奇怪, 设计模式并不是非有不可,可是它能让代码变的更美好。 程序员大可闷头堆代码, 复制粘贴, 然后不断的感慨代码难以维护, 难以复用, 难以扩展, 而继续不思进取。 当然也可以选折不断去追求更美好, 更合理的代码, 把自己从bug调试, 需求变动等噩梦中拯救出来, 进而真正体会到编码的乐趣。 你如果选... 阅读全文
posted @ 2013-02-05 16:09 fxjwind 阅读(305) 评论(0) 推荐(0) 编辑

Programming Clojure - Unifying Data with Sequences

摘要: In Clojure, all these data structures can be accessed through a single abstraction: the sequence (or seq). A seq (pronounced “seek”) is a logical list, the seq is an abstraction that can be used e... 阅读全文
posted @ 2013-02-04 14:55 fxjwind 阅读(438) 评论(0) 推荐(0) 编辑

Programming Cljr – working with Java

摘要: Working with Java In this chapter, you will see how Clojure access to Java is convenient, elegant, and fast: • Calling Java is simple and direct. Clojure provides syntax extensions for acces... 阅读全文
posted @ 2013-01-31 11:38 fxjwind 阅读(5423) 评论(0) 推荐(0) 编辑

Pratical Cljr – loop/recur

摘要: Programming Clojure这块写的过于简单, Pratical Clojure写的还不错, 这本书在某些章节写的深度不错, 讨论why, 而不是仅仅how, 故摘录首先, Clojure是不提供直接的looping语法的!!! 这个理解很重要因为looping是imperative的概念, 对于FP, 需要改变思维的方式, 用递归来解决同样的问题, 所以下面也说对于从imperative 转来的程序员, 习惯从递归(recursive)的角度思考问题, 是很大的挑战.It will probably come as a minor shock to users of imperat 阅读全文
posted @ 2013-01-24 16:04 fxjwind 阅读(618) 评论(0) 推荐(0) 编辑
上一页 1 ··· 39 40 41 42 43 44 45 46 47 ··· 53 下一页