随笔分类 -  Functional Programming

1 2 下一页

Scala 泛型
摘要:参考,Programing in Scalascala中的协变和逆变--------------------------------------------------------------------------------------------------------------------... 阅读全文

posted @ 2013-12-18 15:32 fxjwind 阅读(7386) 评论(0) 推荐(0)

Akka Essentials - 2
摘要:Actors Defining an actor class MyActor extends Actor { def receive = { }} In Scala, the receive block is actually a partial function, which allows the usage of pattern matching syntax.... 阅读全文

posted @ 2013-11-17 20:31 fxjwind 阅读(1411) 评论(0) 推荐(0)

Akka Essentials - 1
摘要:参考Akka Essentials 1 Introduction to Akka Actor Model Actor模式的由来 In 1973, Carl Hewitt, Peter Bishop, and Richard Steiger wrote a paper—A Universal Modular ACTOR Formalism for Artificial Intel... 阅读全文

posted @ 2013-11-15 18:18 fxjwind 阅读(1752) 评论(0) 推荐(0)

Scala 常用语法
摘要:Clojure首先是FP, 但是由于基于JVM, 所以不得已需要做出一些妥协, 包含一些OO的编程方式 Scala首先是OO, Java语法过于冗余, 一种比较平庸的语言, Scala首先做的是简化, 以更为简洁的方式来编写OO, 主要利用‘type inference’能推断出来的, 你就不用写, 但如果仅仅这样, 不如用python 所以Scala象其名字一样, “可伸展的语言”... 阅读全文

posted @ 2013-09-25 15:17 fxjwind 阅读(33940) 评论(2) 推荐(2)

变量可变性问题
摘要:从FP的角度, Clojure中变量是不可变的, 改变一个变量实际是创建一个新的变量 所以所有的change都需要通过参数的不断传递... 如下面的例子, => (defrecord Employee [name room])backtype.storm.util.Employee=> (def emp (Employee. "John Smith" 304))#'backtype.s... 阅读全文

posted @ 2013-08-16 15:38 fxjwind 阅读(619) 评论(0) 推荐(0)

Storm-源码分析- Multimethods使用例子
摘要:1. storm通过multimethods来区分local和distributed模式 当调用launch-worker的时候, clojure会自动根据defmulti里面定义的fn来判断是调用哪个版本的launch-worker (defmulti launch-worker (fn [supervisor & _] (cluster-mode (:conf supervis... 阅读全文

posted @ 2013-06-28 16:39 fxjwind 阅读(708) 评论(0) 推荐(0)

Clojure常用模块
摘要:http://qiujj.com/static/clojure-handbook.html http://clojure.github.io/clojure/ Base ->, (-> x form & more) http://clojuredocs.org/clojure_core/clojure.core/-%3E 线性化嵌套, 使其更具有可读性, Inserts x as the se... 阅读全文

posted @ 2013-06-04 17:48 fxjwind 阅读(1558) 评论(0) 推荐(0)

Protocol and DataType
摘要:https://www.ibm.com/developerworks/cn/java/j-clojure-protocols/, 通过 Clojure 1.2 解决表达式问题 http://code.google.com/p/clojure-doc-en2ch/wiki/Chapter_13_Datatypes_and_Protocols, Practical Clojure 表达式问... 阅读全文

posted @ 2013-05-31 14:50 fxjwind 阅读(1113) 评论(0) 推荐(0)

Leiningen
摘要:https://github.com/technomancy/leiningen 1 What's Leiningen Leiningen is a tool for automating Clojure projects without setting your hair on fire. If you come from the Java world, Leiningen is "... 阅读全文

posted @ 2013-03-07 14:36 fxjwind 阅读(1205) 评论(0) 推荐(0)

The Joy of Clojure – Clojure philosophy(1)
摘要:The Clojure way Simplicity, 简约 It’s hard to write simple solutions to complex problems. But every experienced programmer has also stumbled on areas where we’ve made things more complex than nece... 阅读全文

posted @ 2013-03-01 15:21 fxjwind 阅读(460) 评论(0) 推荐(0)

Practical Clojure - Parallel Programming
摘要:Agents Agent是一种异步数据更新的机制. 但同时也是一种并发机制, 因为agent是基于thread pool实现的, 通过send和send-off分别发送到不同的thread pool中. 其中send对应的thread pool中的线程个数基本等于cup核数, 所以多条send指令其实是自动以cup核数的并发度进行并发处理的. 巧妙利用这个机制就可以实现并发... 阅读全文

posted @ 2013-02-28 16:36 fxjwind 阅读(373) 评论(0) 推荐(0)

Programming clojure – Multimethods
摘要:Multimethods, 其实就是FP基础里面说的, Pattern Matching, 说白了, 就是根据不同的参数定义不同的逻辑. 我首先想到的是函数重载, http://www.cnblogs.com/skynet/archive/2010/09/05/1818636.html 参数个数重载, 对于这种clojure函数天然支持, 如下可以定义多组参数列表 (de... 阅读全文

posted @ 2013-02-28 11:06 fxjwind 阅读(551) 评论(0) 推荐(0)

Practical clojure – Macros and Metaprogramming
摘要:What Is Metaprogramming? Metaprogramming is the use of code to modify or create other code. It is primarily a developer tool and acts as a force multiplier, allowing large amounts of predictable c... 阅读全文

posted @ 2013-02-27 11:25 fxjwind 阅读(473) 评论(0) 推荐(0)

Programming clojure – Concurrency
摘要:Clojure的并发, 这兄弟写的比较系统, http://www.blogjava.net/killme2008/archive/2010/07/archive/2010/07/14/326027.html Concurrency is a fact of life and, increasingly, a fact of software. 为什么需要并发? • Expensive com... 阅读全文

posted @ 2013-02-20 11:55 fxjwind 阅读(580) 评论(0) 推荐(0)

The Joy of Clojure – Laziness(6.3)
摘要:Clojure is partially a lazy language. Clojure is lazy in the way it handles its sequence types. Laziness是FP重要的特征, pure FP应该是lazy language, 比如Haskell. 当然完全的lazy带来问题是, 无法保证程序的执行顺序. 而Clojure是在实用性和... 阅读全文

posted @ 2013-02-17 15:28 fxjwind 阅读(621) 评论(0) 推荐(0)

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 阅读(469) 评论(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 阅读(331) 评论(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 阅读(543) 评论(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 阅读(335) 评论(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 阅读(453) 评论(0) 推荐(0)

1 2 下一页