Veha Suwatphisankij
!@#@$^&%&
me :
github.com/vehas
fb.me/vehas
ex:
react-native, redux,
redux-saga, styled-component
current:
clojure job seeker
host-independent
immutable
lisp
macro
fast
functional programming
runtime polymorphishm
data first
immutable
functional programming
runtime polymorphism
lisp
-macro
-simply
-extensible
immutable.js
lodash.js
monkey patch (extend prototype)
-binding expresstion
-proxy, reflex
repl
hot-reload via webpack
simple data with macro (reagent)
jsx : new language extension
problem : declarative view (aka: React )
(defn acceptedCard
[title long-text]
[:div.container
[:div.text long-text]
[:div.button title]])
const acceptedCard =
({title, longText}) =>
<div className="container">
<div className="text">
{longText}
</div>
<div className="button">
{title}
</div>
</div>
build in
immutable.js
problem : immutable data structure
(def group-a
[ "manee" "vichai"])
(def group-b
[ "predee" "vela"])
(def all-group-name
(concat group-a group-b))
const { List } =
require('immutable');
const groupA =
List([ "name1", "name2" ]);
const groupB =
List([ "name3", "name4" ]);
const group =
List.concat(groupA, groupB);
macro
sweet.js
problem : macro
(defmacro backwards
[form]
(reverse form))
syntax hi = function (ctx) {
return #`console.log('hello!')`;
}
hi
babel
export default function ({Plugin, types: t}) {
return new Plugin('ast-transform', {
visitor: {
Identifier(node) {
return t.identifier(node.name
.split('').reverse().join(''));
}
}
});
}
repl, fig wheel
hot reload -webpack
problem : live coding
google closure compiler
uglify
minify
extern
explicit export
webpack
+ tons of plug ins
problem : dead code elimination
problem : work with js codebase
js => clojurescript
cljs => js
js global
js module with extern, or cljsjs
;clojurescript
(ns my-name-space)
(defn ^:export add-numbers [a b]
(+ a b))
// js
my_name_space.core.add_numbers(1,2);
(. js/window (hello))
(.somemodule some-lib some-input)
dev tool
chrome dev tool
source map
repl
debugger
chrome dev tool
source map (for es.next)
browser console
debugger
problem: i want to try clojurescript
learning interactively
install
mac : http://www.lispcast.com/clojure-mac
ubuntu : http://www.lispcast.com/clojure-ubuntu
window 7: http://www.lispcast.com/clojure-windows-7
window 8, 10: http://www.lispcast.com/clojure-windows-8
online IDE: http://nightcoders.net/
press & play
clojruescript: https://book.klipse.tech/interactive_clojure[script]_code_snippets.html
reagent : http://blog.klipse.tech/reagent/2016/12/31/reagent-in-klipse.html
By Veha Suwatphisankij