16 Sep 2022

CQRS与Event Sourcing

介绍 CQRS = Command and Query Responsibility Segregation 命令和查询责任分离 Martin Fowler的介绍:link 传统架构(不分离的架构) 应用中有一个Model层,有一个Serv...
15 Sep 2022

双因素认证(2FA)与HOTP/TOTP

名词定义 HOTP: HMAC-based One-Time Password TOTP: 基于时间的一次性密码算法(Time-based One-Time Password) 2FA: 双因素认证(Two-Factor Authentic...
06 Sep 2022

函数式编程在前端的应用:Elm和re-frame

Elm Elm启发了Redux和Vuex,在github上有专门的 elm-architecture 主题。 Elm本身是一个函数式编程语言,同时也是一个Web框架。整个Web框架的核心数据流,类似于一个reduce函数:当前状态 ->...
05 Sep 2022

范畴论基础(10) - Kleisli Arrow

一个返回容器类的函数,签名是 f :: a -> m b,这里的类型 m,如果是个 Monad,那这个函数可以被称为 monadic function。 如果再来一个 monadic function,签名是 g :: b ->...
31 Aug 2022

ClojureScript中的goog.DEBUG

goog.DEBUG 谁来设置? shadow-cljs会自动设置,参考这里 ^boolean 是什么 re-frame的template中会自动生成一个变量,其中使用了 ^boolean 这个type hint (def debug? ^...
29 Aug 2022

Reduce与Transducer

reduce/foldl/foldr reduce是函数式编程中用于处理列表(数组、序列等可迭代数据结构)一个最重要的函数,haskell中是foldl和foldr。其中foldl与reduce含义相同,是从列表的最左面一个元素开始执行,f...