Converting Recursive Traversal to Iterator

摘要: Introduces a general pattern named Lazy Iterator for converting recursive traversal to iterator. It can be used to simulate generator (the "yield" keyword) in languages like Python.阅读全文
posted @ 2017-11-13 12:31 Todd Wei 阅读(57) 评论(0) 编辑

Monad Explained in One Picture

摘要: The point of Monad is composability. In the green category, T -> Monad and U -> Monad阅读全文
posted @ 2017-05-05 13:00 Todd Wei 阅读(373) 评论(0) 编辑

Stateful Future Transformation

摘要: A general function to transform the future of an initial state to the future of its final state.阅读全文
posted @ 2017-03-13 03:11 Todd Wei 阅读(249) 评论(0) 编辑

Function Composition vs Object Composition

摘要: Functions are born in a harmonious ecosystem. Whenever you write a function, you automatically enjoy compose, functors, monads, monad transformers...阅读全文
posted @ 2017-02-06 14:55 Todd Wei 阅读(309) 评论(0) 编辑

Distributed MVCC based cross-row transaction

摘要: The algorithm for supporting distributed MVCC based multi-row transactions on top of a distributed key-value database with single-row transaction support.阅读全文
posted @ 2016-11-28 15:30 Todd Wei 阅读(231) 评论(0) 编辑

A Beginner's Guide to Paxos

摘要: The code ideas of Paxos protocol: 1) Optimistic concurrency control (variant 2). Hold a "preemptible lock" first, try updating, restart on denial; 2) Quorum as a logical unit of acceptor for choose operation. A value is chosen iff it's accepted by a quorum, which implies from the proposer's perspective the choose operation is atomic, it's all or nothing, it's either accepted by a quorum or it isn't.阅读全文
posted @ 2016-07-07 14:33 Todd Wei 阅读(580) 评论(1) 编辑

Functional Programming without Lambda - Part 2 Lifting, Functor, Monad

摘要: fmap :: (T -> R) -> Functor<T> -> Functor<R> lifts a function of type T -> R into a function of type Functor<T> -> Functor<R>; flatMap :: (T -> Monad<R>) -> Monad<T> -> Monad<R> lifts a function of type T -> Monad<R> into a function of type Monad<T> -> Monad<R>.阅读全文
posted @ 2015-05-30 12:47 Todd Wei 阅读(1329) 评论(0) 编辑

Functional Programming without Lambda - Part 1 Functional Composition

摘要: Functional programming doesn't necessarily depend on Lambda, it's more about the unique way of composing a bunch a small functions into a larger one.阅读全文
posted @ 2015-05-25 13:35 Todd Wei 阅读(1429) 评论(0) 编辑


摘要: 本文介绍了自己总结的Java异常处理的原理和原则,包括:1.Exception和Error的区别;2.声明异常和未声明异常的区别;3.什么情况下应抛出未声明异常;4.如何捕获和处理其他方法抛出的异常;5.自定义异常应继承Exception还是RuntimeException。阅读全文
posted @ 2014-11-02 09:46 Todd Wei 阅读(6486) 评论(11) 编辑


摘要: 本文提出了一种观点:从应用的角度,我们可以把线性代数视为一门领域特定语言(DSL)。线性代数在初等数学基础上建立了向量模型,定义了一套语法和语义,符合程序语言的语言契约。向量模型具有坐标系无关性的优点,可以用来表达线性关系。它是整个线性代数的核心,是解决线性空间问题的最佳模型。阅读全文
posted @ 2014-05-21 22:07 Todd Wei 阅读(13937) 评论(18) 编辑



  • 随笔 - 62
  • 文章 - 43
  • 评论 - 1160