This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[関数型言語のウソとホント](http://qiita.com/hiruberuto/items/810ecdff0c1674d1a74e) | |
に引き続き、 | |
[純粋関数型JavaScriptのつくりかた](http://qiita.com/hiruberuto/items/810ecdff0c1674d1a74e) | |
という、とても有意義な記事を @hiruberuto 氏が連発しておられます。 | |
この一連の記事を起点にして思うことをいくつか共有します。 | |
----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
純粋関数型言語の定義は論争があるらしいです。 | |
多くの人が純粋関数型言語は副作用がない、という文脈で語っています。 | |
ところが、よくよく調べてみると、その「副作用」というのがかなりトリッキーなワードで、彼ら自身がIO(入出力)と副作用の関係、さらに参照透過との関係があまりよくわかっていない感じで、原因と結果がはちゃめちゃな言葉遣いをしているのをみます。 | |
私が純粋関数型っていうのは遅延評価戦略が不可分だ、って書いていたら、 | |
副作用の排除(この言葉がどういう感じで彼らに使われているのかが未だよくわからない)が重要だ、いう文脈でJavaScriptを純粋関数化する!という優秀な人が現れ、JavaScriptにHaskellのIOモナドを実装してしまいました。 | |
そのコードを見ると、それはJavaScriptに遅延評価を実装する典型的なコードであり、挙動の説明も完全に遅延評価でFRPの話でした。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const identity = a => a; | |
const customOperator = op => f => set => | |
Object.defineProperty(set, op, { | |
value: function (a) { | |
return f(a)(this); | |
} | |
});//returns new set/object | |
Function.prototype |> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##関数型プログラミングとオブジェクト指向の抜き差しならない関係について考え、整理したい | |
Googleで適当に検索すると | |
####オブジェクト指向 関数型プログラミングに関連する検索キーワード | |
オブジェクト指向プログラミング関数プログラミング比較 | |
オブジェクト指向関数プログラミング | |
オブジェクト指向関数型違い | |
関数型言語オブジェクト指向 | |
手続き型オブジェクト指向関数型 | |
オブジェクト指向vs関数型 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#React 入門 2016 あるいは statelessさらにprop不要で関数型・宣言型的にコーディングする手法 | |
#React(0.14+), JavaScript(ES6)は変化が激しすぎるのでReact入門記事を全面改訂します | |
当ブログで昨年2015年4月にUPしたReact解説記事(2つ) | |
- [React (.js Facebook)解説 関数型プログラミングに目覚めた! IQ145の女子高生の先輩から受けた特訓5日間 サポート記事 静的HTML編](http://kenokabe-techwriting.blogspot.jp/2015/04/react-js-facebook-iq145-html.html) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8" /> | |
<!-- Required styles for MDC Web --> | |
<link rel="stylesheet" href="https://unpkg.com/material-components-web@latest/dist/material-components-web.min.css"> | |
<style type="text/css"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
//Issue: | |
//not compatible with TypeScript Types | |
// "@types/react" | |
// "@types/react-dom" | |
//TypeScript | |
// import * as React from "react"; | |
// import * as ReactDOM from "react-dom"; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const typedPrimitive = (I: Function) => (i: undefined) => { | |
const derived = Object(i); | |
Object.setPrototypeOf(derived, Object(i)); | |
const typeProperty = { | |
enumerable: false, | |
configurable: false, | |
writable: false, | |
value: I |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
const equalJSON = a => b => JSON.stringify(a) === JSON.stringify(b); | |
const logEq = a => b => { | |
const result = equalJSON(a)(b); | |
console.log(result); | |
return result; | |
}; | |
NewerOlder