Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
From JS To CLJS
Search
Kent OHASHI
May 12, 2017
Programming
0
41
From JS To CLJS
JavaScriptからClojureScriptへ
ClojureをJavaScriptの世界でも利用しよう!
Kent OHASHI
May 12, 2017
Tweet
Share
More Decks by Kent OHASHI
See All by Kent OHASHI
関数型言語テイスティング: Haskell, Scala, Clojure, Elixirを比べて味わう関数型プログラミングの旨さ
lagenorhynque
1
76
純LISPから考える関数型言語のプリミティブ: Clojure, Elixir, Haskell, Scala
lagenorhynque
1
66
From Scala/Clojure to Kotlin
lagenorhynque
0
29
TDD with RDD: Changed Developer Experience through Clojure/Lisp REPLs
lagenorhynque
0
55
My Favourite Book in 2024: Get Rid of Your Japanese Accent
lagenorhynque
1
88
do Notation Equivalents in JVM languages: Scala, Kotlin, Clojure
lagenorhynque
0
63
map関数の内部実装から探るJVM言語のコレクション: Scala, Kotlin, Clojureコレクションの基本的な設計を理解しよう
lagenorhynque
0
58
Kotlin Meets Data-Oriented Programming
lagenorhynque
0
55
Introduction to Tree Representations in RDB 2024
lagenorhynque
0
85
Other Decks in Programming
See All in Programming
なぜ適用するか、移行して理解するClean Architecture 〜構造を超えて設計を継承する〜 / Why Apply, Migrate and Understand Clean Architecture - Inherit Design Beyond Structure
seike460
PRO
1
280
GraphRAGの仕組みまるわかり
tosuri13
7
450
Bytecode Manipulation 으로 생산성 높이기
bigstark
2
360
AWS CDKの推しポイント 〜CloudFormationと比較してみた〜
akihisaikeda
3
290
git worktree × Claude Code × MCP ~生成AI時代の並列開発フロー~
hisuzuya
0
170
イベントストーミング図からコードへの変換手順 / Procedure for Converting Event Storming Diagrams to Code
nrslib
1
150
deno-redisの紹介とJSRパッケージの運用について (toranoana.deno #21)
uki00a
0
130
エラーって何種類あるの?
kajitack
5
280
Webからモバイルへ Vue.js × Capacitor 活用事例
naokihaba
0
740
レガシーシステムの機能調査・開発におけるAI利活用
takuya_ohtonari
0
610
Go1.25からのGOMAXPROCS
kuro_kurorrr
1
790
Railsアプリケーションと パフォーマンスチューニング ー 秒間5万リクエストの モバイルオーダーシステムを支える事例 ー Rubyセミナー 大阪
falcon8823
3
750
Featured
See All Featured
Facilitating Awesome Meetings
lara
54
6.4k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
281
13k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Done Done
chrislema
184
16k
Product Roadmaps are Hard
iamctodd
PRO
53
11k
Fireside Chat
paigeccino
37
3.5k
Git: the NoSQL Database
bkeepers
PRO
430
65k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
4
200
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
20
1.3k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
32
2.3k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
252
21k
Why You Should Never Use an ORM
jnunemaker
PRO
56
9.4k
Transcript
From JS To CLJS - Adieu JavaScript -
Self-introduction /laʒenɔʁɛ̃k/ カマイルカ lagénorhynque (defprofile lagénorhynque :name "Kent OHASHI" :account
@lagenorhynque :company "Opt, Inc." :languages [Clojure Haskell Python Scala English français Deutsch русский] :interests [programming language-learning mathematics] :contributing [github.com/japan-clojurians/clojure-site-ja])
Contents 1. What is ClojureScript? 2. Why does ClojureScript matter?
3. Language 4. Libraries 5. Tools
What is ClojureScript?
によると ClojureScript公式サイト ClojureScript is a compiler for Clojure that targets
JavaScript. It emits JavaScript code which is compatible with the advanced compilation mode of the Google Closure optimizing compiler.
ClojureScript (CLJS) JavaScriptをターゲットとしたClojureのコンパイラ cf. : Java/JVMがターゲット の 互換のJSコードを⽣成 Clojure Google
Closure Compiler advanced compilation mode
compilation process from ClojureScript: Up and Running
Why does ClojureScript matter?
JavaScriptの世界でもClojureのメリットを REPL駆動のインタラクティブな開発 関数型プログラミング 並⾏プログラミング 現代的なLisp → Webフロントエンド, , , etc.
Electron React Native
フロントエンド・サーバサイド間のスムーズな連携 コードの共有 .cljc & データの共有 , (cf. JSON, ) →
フロントエンドもサーバサイドもClojure reader conditionals EDN Transit MessagePack
Language
syntax cf. ※ CLJSのWeb REPL(e.g. )で試そう ClojureScript Synonyms ClojureScript -
Differences from Clojure Macros Replumb REPL
Clojure, ClojureScriptなどプラットフォーム間での 差異を吸収するための仕組み 拡張⼦ .cljc のファイル内で利⽤ と reader conditionals #?
#?@ (defn str->int [s] #?(:clj (java.lang.Integer/parseInt s) :cljs (js/parseInt s)))
Libraries
library references The Clojure Toolbox CrossClj razum2um/awesome-clojure
example: のReagent実装 cf. 採⽤例: Reagent A minimalistic ClojureScript interface to
React.js Reactチュートリアル lagenorhynque/react-tutorial Om circleci/frontend
Tools
build /ˈlainɪŋən/ Clojure, ClojureScript共通のビルドツール プラグインやプロジェクトテンプレートが豊富 設定ファイル project.clj (e.g. ) cf.
Leiningen react-tutorial Boot
hot loading Leiningenプラグイン ClojureScriptのオートビルド ブラウザのオートリロード etc. lein-figwheel
optimization CLJSのコンパイラオプション :optimizations level effect :none 最適化なし(デフォルト) :whitespace コメント/空⽩など削除 :simple
ローカル変数/関数引数リネーム :advanced グローバル変数/関数名/プロパ ティリネーム,デッドコード削 除,etc. Google Closure Compiler
Further Reading サイト : 公式サイト cf. : GitHub 書籍 翻訳:
ClojureScript Clojure clojure/clojurescript ClojureScript: Up and Running 『⼊⾨ ClojureScript』 ClojureScript Unraveled
スライド 英語版: ⼊⾨ClojureScript ClojureScriptという選択肢 ここ最近のClojureScript JavaからClojureへ From Java To Clojure