When you want to build your logic with small, composable functions you need a functional way to handle conditional logic. You could wrap ternary expressions and if/else statements in functions, handling all of the concerns around data mutation yourse…
前言:Hive ql自己设计总结 1,遇到复杂的查询情况,就分步处理.将一个复杂的逻辑,分成几个简单子步骤处理. 2,但能合在一起的,尽量和在一起的.比如同级别的多个concat函数合并一个select 也就是说,字段之间是并行的同级别处理,则放在一个hive ql:而字段间有前后处理逻辑依赖(判断.补值.计算)则可分步执行,提前将每个字段分别处理好,然后进行相应的分步简单逻辑处理. 一. 场景:日志中region数据处理(国家,省份,城市) select city_id,province_id…
Handling your logic with composable functions makes your code declarative, leading to code that's easy to read and easy to test. Breaking that up to wrap some risky function in a try/catch block introduces imperative code and makes it harder to maint…
The difference between sort, sortBy, sortWith is that: 1. sort: take function as args. 2. sortBy: take prop as args. 3. sortWith: take array of funcs as args. const R = require('ramda'); const {sort, sortBy, sortWith, descend, prop, ascend} = R; cons…
In this lesson we'll learn the basics of using lenses in Ramda and see how they enable you to focus changes on specific properties of an object while keeping your data immutable. what 'R.lens' do is able to get or set prop value but keep the object i…
From: const onSeachClick = (searchTerm) => { if(searchTerm !== '') { searchForMovies(searchTerm) } else { console.log('a search term should be provided') } } To: // Utils const inNotEmpty = R.compose( R.not, R.isEmpty ); const onSearchClick = () =>…
Getter on Object: 1. prop: R.prop(}); //=> 100 R.prop('x', {}); //=> undefined 2. props: R.props([, y: }); //=> [1, 2] R.props([, a: }); //=> [undefined, 1, 2] Setter ob Object: R.assoc(, {a: , b: }); //=> {a: 1, b: 2, c: 3} Another way to…
一.ES6的Set.Map数据结构 Map.Set都是ES6新的数据结构,都是新的内置构造函数,也就是说typeof的结果,多了两个: Set 是不能重复的数组 Map 是可以任何东西当做键的对象 ES6 提供了新的数据结构 Set.它类似于数组,但是成员的值都是唯一的,没有重复的值. let s = new Set(); s.add(1); s.add(2); s.add(3); s.add(3); s.add(3); s.add(4); s.add(5); console.log(s) 示例…
Hybrid transaction memory systems and accompanying methods. A transaction to be executed is received, and an initial attempt is made to execute the transaction in a hardware path. Upon a failure to successfully execute the transaction in the hardware…
50分钟学会Laravel 50个小技巧 时间 2015-12-09 17:13:45  Yuansir-web菜鸟 原文  http://www.yuansir-web.com/2015/12/09/50分钟学会laravel-50个小技巧/ 主题 Laravel 转载请注明:转载自 Yuansir-web菜鸟 | LAMP学习笔记 本文链接地址: 50分钟学会Laravel 50个小技巧 原文链接:< 50 Laravel Tricks in 50 Minutes by willroth >…