SlideShare une entreprise Scribd logo
1  sur  16
Télécharger pour lire hors ligne
 Clojure
Language Update
Clojure 1.7勉強会
2015/06/27 @HaLake
@athos0220
数字で見るClojure 1.7
‣ 開発期間:2014/5/25∼ (2014/8/6 alpha1リリース)
‣ チケット数:116 /570
‣ コミット数:159 /2756
‣ コミッター:30人 /130
‣ コード行数
- *.java:58067行 (+3582, -1011)
-  *.clj:32488行 (+2530, -1296)
数値は2015/6/25現在のもの
Clojure 1.7 変更点 概観
‣ Transducers (詳細は@athos0220の発表)
対象となるデータ構造に依存しない、各要素の変換アルゴリズムの記述方法
‣ Reader Conditionals (詳細は@_ayato_pさんの発表)
Clojure/ClojureScript/ClojureCLR間での相互運用性向上のための仕組み
‣ その他新機能
‣ パフォーマンス向上
‣ 機能向上
変更点の詳細・一覧についてはChangeLogを参照のこと
その他新機能
‣ :warn-boxed-math
‣ REPLでのデータの表示方法
‣ update関数
‣ run!関数
‣ volatile
‣ etc.
update関数
‣ update-inのネストしない版
user=> (def m {:a 0})
#’user/m
user=> (update m :a inc)
{:a 1}
;; これまでは下のようにする必要があった
user=> (update-in m [:a] inc)
{:a 1}
user=>
run!関数
‣ (run! proc s) = (reduce #(proc %2) nil s)
‣ シーケンスの各要素に副作用を起こすときに便利
user=> (run! println (range 3))
0
1
2
nil
user=>
volatile
‣ Atomより効率のよい破壊的変更を実現する
‣ stateful transducerを書くために導入された
user=> (def v (volatile! 0))
#’user/v
user=> (vreset! v 42)
42
user=> (vswap! v inc)
43
user=> @v
43
REPLでのデータの表示方法
‣ 表示方法が定義されていないオブジェクトをタグ付き
リテラルとして表示
‣ nREPLなどで評価結果を受け渡すのが便利に
user=> *ns*
#object[clojure.lang.Namespace 0x13823a1f “user”]
user=> (defn f [x])
#’user/f
user=> f
#object[user$f 0x2b65f534 “user$f@2b65f534”]
user=>
:warn-on-boxed
‣ 数値演算がプリミティブ型でなくボクシングされた
型で行なわれたときに警告を出す
user=> (defn f [x] (+ x 2))
#’user/f
user=> (set! *unchecked-math* :warn-on-boxed)
true
user=> (defn f’ [x] (+ x 2))
Boxed math warning, NO_SOURCE_PATH:10:18 …
user=> (defn f’’ [^long x] (+ x 2))
#’user/f’’
パフォーマンス向上
‣ reduceの高速化
‣ キーワード・シンボルのインターン
‣ Multimethodのキャッシュ
‣ vec/setの高速化
‣ etc. etc.
reduceの高速化
‣ 以下の関数が、IReduceを実装した固有のシーケンスを返すよ
うになった
‣ repeat
‣ cycle
‣ iterate
‣ range
‣ keys
‣ vals
‣ iterator-seq
機能向上
‣ aproposの表示改善
‣ IAtomインタフェースの分離
‣ 関数クラスのマングリングルール修正
‣ etc. etc.
aproposの表示改善
‣ 結果が名前空間修飾されて返ってくるように
‣ 各シンボルがどの名前空間に含まれるか識別可能
user=> (apropos #”^replace$”) ;; ∼1.6
(replace replace replace …)
user=> (apropos #”^replace$”) ;; 1.7∼
(clojure.core/replace clojure.string/replace
clojure.zip/replace …)
user=>
IAtomインタフェースの分離
‣ アトミックな値更新操作をIAtomインタフェースと
してAtomから分離
‣ ユーザ定義型でもreset!/swap!などが使えるように
関数名のマングリングルール修正
‣ 関数に対応するクラスを生成する際の、マングリング
された名前が衝突するのを修正
code before after
(defn a []) user$a user$a
(fn []) user$evalN$fn__N user$evalN$fn__N
(fn a []) user$evalN$a__N user$evalN$a__N
(let [a (fn [])] a) user$evalN$a__N user$evalN$a__N
(let [a (fn x [])] a) user$evalN$x__N user$evalN$a_x_N
(def a (fn [])) user$a user$a
(def a (fn x [])) user$x user$a_x_N
(def ^{:foo (fn [])} a) user$fn__N user$fn__N
(def ^{:foo (fn a [])} a) user$a user$a__N
(def a (fn [] (fn []))) user$a$fn__N user$a$fn__N
(def a (fn [] (fn x []))) user$a$x__N user$a$x__N
まとめ
‣ Clojure 1.7はさまざま環境でのコードの再利用性
を向上させる試みが取り入れられたリリース
‣ ClojureScriptやcore.asyncなどとの協調がさらに
便利になっていくかも?

Contenu connexe

Tendances

Om Next ~React.jsを超えて
Om Next ~React.jsを超えてOm Next ~React.jsを超えて
Om Next ~React.jsを超えてKazuki Tsutsumi
 
Thread affinity and CPS
Thread affinity and CPSThread affinity and CPS
Thread affinity and CPSKouji Matsui
 
JavaEE7徹底入門 プレゼンテーション層の開発 JSF
JavaEE7徹底入門 プレゼンテーション層の開発 JSFJavaEE7徹底入門 プレゼンテーション層の開発 JSF
JavaEE7徹底入門 プレゼンテーション層の開発 JSFMasuji Katoda
 
AngularJS2でつまづいたこと
AngularJS2でつまづいたことAngularJS2でつまづいたこと
AngularJS2でつまづいたことTakehiro Takahashi
 
テンプレートエンジンにMixer2を使うとSeleniumでのテストもラクになるかもねという話
テンプレートエンジンにMixer2を使うとSeleniumでのテストもラクになるかもねという話テンプレートエンジンにMixer2を使うとSeleniumでのテストもラクになるかもねという話
テンプレートエンジンにMixer2を使うとSeleniumでのテストもラクになるかもねという話Y Watanabe
 
SpockからRSpecにきたときの気づき #coedorb
SpockからRSpecにきたときの気づき #coedorbSpockからRSpecにきたときの気づき #coedorb
SpockからRSpecにきたときの気づき #coedorbYoutarou TAKAHASHI
 
JavaScriptフレームワーク入門にVue.jsはいかが?
JavaScriptフレームワーク入門にVue.jsはいかが?JavaScriptフレームワーク入門にVue.jsはいかが?
JavaScriptフレームワーク入門にVue.jsはいかが?好洋 山崎
 
jQueryを中心としたJavaScript
jQueryを中心としたJavaScriptjQueryを中心としたJavaScript
jQueryを中心としたJavaScripthideaki honda
 
Arachne Unweaved (JP)
Arachne Unweaved (JP)Arachne Unweaved (JP)
Arachne Unweaved (JP)Ikuru Kanuma
 
continuatioN Linking
continuatioN LinkingcontinuatioN Linking
continuatioN LinkingKouji Matsui
 
JavaのテストGroovyでいいのではないかという話
JavaのテストGroovyでいいのではないかという話JavaのテストGroovyでいいのではないかという話
JavaのテストGroovyでいいのではないかという話disc99_
 
svelte と tailwind で始めるフロントエンド開発
svelte と tailwind で始めるフロントエンド開発svelte と tailwind で始めるフロントエンド開発
svelte と tailwind で始めるフロントエンド開発Shuichi Takaya
 
Blazor 触ってみた
Blazor 触ってみたBlazor 触ってみた
Blazor 触ってみたOda Shinsuke
 
PHPerがgolangでもがいてる話@第1回 関西Golang勉強会
PHPerがgolangでもがいてる話@第1回 関西Golang勉強会PHPerがgolangでもがいてる話@第1回 関西Golang勉強会
PHPerがgolangでもがいてる話@第1回 関西Golang勉強会Keisuke Utsumi
 
Jjugccc2017spring m6 javafx
Jjugccc2017spring m6 javafxJjugccc2017spring m6 javafx
Jjugccc2017spring m6 javafxtorutk
 
Jvm言語とJava、切っても切れないその関係
Jvm言語とJava、切っても切れないその関係Jvm言語とJava、切っても切れないその関係
Jvm言語とJava、切っても切れないその関係yy yank
 
で、次は何がくるの? - 第2回 TIS Matsuri
で、次は何がくるの? - 第2回 TIS Matsuriで、次は何がくるの? - 第2回 TIS Matsuri
で、次は何がくるの? - 第2回 TIS MatsuriYoshitaka Kawashima
 
JJUG CCC 2016 fall バイトコードが君のトモダチになりたがっている
JJUG CCC 2016 fall バイトコードが君のトモダチになりたがっているJJUG CCC 2016 fall バイトコードが君のトモダチになりたがっている
JJUG CCC 2016 fall バイトコードが君のトモダチになりたがっているKoichi Sakata
 

Tendances (19)

Om Next ~React.jsを超えて
Om Next ~React.jsを超えてOm Next ~React.jsを超えて
Om Next ~React.jsを超えて
 
Thread affinity and CPS
Thread affinity and CPSThread affinity and CPS
Thread affinity and CPS
 
JavaEE7徹底入門 プレゼンテーション層の開発 JSF
JavaEE7徹底入門 プレゼンテーション層の開発 JSFJavaEE7徹底入門 プレゼンテーション層の開発 JSF
JavaEE7徹底入門 プレゼンテーション層の開発 JSF
 
AngularJS2でつまづいたこと
AngularJS2でつまづいたことAngularJS2でつまづいたこと
AngularJS2でつまづいたこと
 
テンプレートエンジンにMixer2を使うとSeleniumでのテストもラクになるかもねという話
テンプレートエンジンにMixer2を使うとSeleniumでのテストもラクになるかもねという話テンプレートエンジンにMixer2を使うとSeleniumでのテストもラクになるかもねという話
テンプレートエンジンにMixer2を使うとSeleniumでのテストもラクになるかもねという話
 
SpockからRSpecにきたときの気づき #coedorb
SpockからRSpecにきたときの気づき #coedorbSpockからRSpecにきたときの気づき #coedorb
SpockからRSpecにきたときの気づき #coedorb
 
Learning jQuery
Learning jQueryLearning jQuery
Learning jQuery
 
JavaScriptフレームワーク入門にVue.jsはいかが?
JavaScriptフレームワーク入門にVue.jsはいかが?JavaScriptフレームワーク入門にVue.jsはいかが?
JavaScriptフレームワーク入門にVue.jsはいかが?
 
jQueryを中心としたJavaScript
jQueryを中心としたJavaScriptjQueryを中心としたJavaScript
jQueryを中心としたJavaScript
 
Arachne Unweaved (JP)
Arachne Unweaved (JP)Arachne Unweaved (JP)
Arachne Unweaved (JP)
 
continuatioN Linking
continuatioN LinkingcontinuatioN Linking
continuatioN Linking
 
JavaのテストGroovyでいいのではないかという話
JavaのテストGroovyでいいのではないかという話JavaのテストGroovyでいいのではないかという話
JavaのテストGroovyでいいのではないかという話
 
svelte と tailwind で始めるフロントエンド開発
svelte と tailwind で始めるフロントエンド開発svelte と tailwind で始めるフロントエンド開発
svelte と tailwind で始めるフロントエンド開発
 
Blazor 触ってみた
Blazor 触ってみたBlazor 触ってみた
Blazor 触ってみた
 
PHPerがgolangでもがいてる話@第1回 関西Golang勉強会
PHPerがgolangでもがいてる話@第1回 関西Golang勉強会PHPerがgolangでもがいてる話@第1回 関西Golang勉強会
PHPerがgolangでもがいてる話@第1回 関西Golang勉強会
 
Jjugccc2017spring m6 javafx
Jjugccc2017spring m6 javafxJjugccc2017spring m6 javafx
Jjugccc2017spring m6 javafx
 
Jvm言語とJava、切っても切れないその関係
Jvm言語とJava、切っても切れないその関係Jvm言語とJava、切っても切れないその関係
Jvm言語とJava、切っても切れないその関係
 
で、次は何がくるの? - 第2回 TIS Matsuri
で、次は何がくるの? - 第2回 TIS Matsuriで、次は何がくるの? - 第2回 TIS Matsuri
で、次は何がくるの? - 第2回 TIS Matsuri
 
JJUG CCC 2016 fall バイトコードが君のトモダチになりたがっている
JJUG CCC 2016 fall バイトコードが君のトモダチになりたがっているJJUG CCC 2016 fall バイトコードが君のトモダチになりたがっている
JJUG CCC 2016 fall バイトコードが君のトモダチになりたがっている
 

En vedette

Small business lending index september 2015
Small business lending index september 2015Small business lending index september 2015
Small business lending index september 2015Biz2Credit
 
From Surveillance to Service Excellence - Big Data in Financial Services
From Surveillance to Service Excellence - Big Data in Financial ServicesFrom Surveillance to Service Excellence - Big Data in Financial Services
From Surveillance to Service Excellence - Big Data in Financial ServicesRob Rensman
 
Prosper.com Microfinance - SVMN.net mtg 2007-09-10
Prosper.com Microfinance - SVMN.net mtg 2007-09-10Prosper.com Microfinance - SVMN.net mtg 2007-09-10
Prosper.com Microfinance - SVMN.net mtg 2007-09-10Dave McClure
 
Mobile App Development
Mobile App DevelopmentMobile App Development
Mobile App DevelopmentChris Morrell
 
Building Better WordPress Sites
Building Better WordPress SitesBuilding Better WordPress Sites
Building Better WordPress SitesBrian LaFrance
 
It May be Time to Reinvent Your Firm - CPAFMA National Practice Management Co...
It May be Time to Reinvent Your Firm - CPAFMA National Practice Management Co...It May be Time to Reinvent Your Firm - CPAFMA National Practice Management Co...
It May be Time to Reinvent Your Firm - CPAFMA National Practice Management Co...Tom Hood, CPA,CITP,CGMA
 
Collaborative Filtering at Spotify
Collaborative Filtering at SpotifyCollaborative Filtering at Spotify
Collaborative Filtering at SpotifyErik Bernhardsson
 
Ten Cities, Four Countries, Five Years: Lessons on the Process of Building Ur...
Ten Cities, Four Countries, Five Years: Lessons on the Process of Building Ur...Ten Cities, Four Countries, Five Years: Lessons on the Process of Building Ur...
Ten Cities, Four Countries, Five Years: Lessons on the Process of Building Ur...The Rockefeller Foundation
 
Where is the conversation?
Where is the conversation?Where is the conversation?
Where is the conversation?ron mader
 
Clojure + MongoDB on Heroku
Clojure + MongoDB on HerokuClojure + MongoDB on Heroku
Clojure + MongoDB on HerokuNaoyuki Kakuda
 
Metagame Design
Metagame DesignMetagame Design
Metagame DesignAmy Jo Kim
 
『はじめてのClojure』勉強会#3 第7章:テスト、テスト、テスト
『はじめてのClojure』勉強会#3 第7章:テスト、テスト、テスト『はじめてのClojure』勉強会#3 第7章:テスト、テスト、テスト
『はじめてのClojure』勉強会#3 第7章:テスト、テスト、テストmakopi 23
 
How to Use Video to Crush Your B2B Marketing Goals
How to Use Video to Crush Your B2B Marketing GoalsHow to Use Video to Crush Your B2B Marketing Goals
How to Use Video to Crush Your B2B Marketing GoalsUberflip
 
IdeaMart: Case Study in Service Innovation Success, Shafraz Rahim, Dialog Axiata
IdeaMart: Case Study in Service Innovation Success, Shafraz Rahim, Dialog AxiataIdeaMart: Case Study in Service Innovation Success, Shafraz Rahim, Dialog Axiata
IdeaMart: Case Study in Service Innovation Success, Shafraz Rahim, Dialog AxiataAlan Quayle
 
ClojureでElectronアプリを作ろう
ClojureでElectronアプリを作ろうClojureでElectronアプリを作ろう
ClojureでElectronアプリを作ろうKazuhiro Hara
 
6 tendances de la formation professionnelle : quand le digital change la donne
6 tendances de la formation professionnelle : quand le digital change la donne6 tendances de la formation professionnelle : quand le digital change la donne
6 tendances de la formation professionnelle : quand le digital change la donneDigital Academy
 

En vedette (20)

Small business lending index september 2015
Small business lending index september 2015Small business lending index september 2015
Small business lending index september 2015
 
From Surveillance to Service Excellence - Big Data in Financial Services
From Surveillance to Service Excellence - Big Data in Financial ServicesFrom Surveillance to Service Excellence - Big Data in Financial Services
From Surveillance to Service Excellence - Big Data in Financial Services
 
매쉬업엔젤스 미디어킷 2016.11
매쉬업엔젤스 미디어킷 2016.11매쉬업엔젤스 미디어킷 2016.11
매쉬업엔젤스 미디어킷 2016.11
 
Prosper.com Microfinance - SVMN.net mtg 2007-09-10
Prosper.com Microfinance - SVMN.net mtg 2007-09-10Prosper.com Microfinance - SVMN.net mtg 2007-09-10
Prosper.com Microfinance - SVMN.net mtg 2007-09-10
 
Preguntas para examen de tic
Preguntas para examen de ticPreguntas para examen de tic
Preguntas para examen de tic
 
Nova Stanford 2016
Nova Stanford 2016Nova Stanford 2016
Nova Stanford 2016
 
Mobile App Development
Mobile App DevelopmentMobile App Development
Mobile App Development
 
Building Better WordPress Sites
Building Better WordPress SitesBuilding Better WordPress Sites
Building Better WordPress Sites
 
It May be Time to Reinvent Your Firm - CPAFMA National Practice Management Co...
It May be Time to Reinvent Your Firm - CPAFMA National Practice Management Co...It May be Time to Reinvent Your Firm - CPAFMA National Practice Management Co...
It May be Time to Reinvent Your Firm - CPAFMA National Practice Management Co...
 
Collaborative Filtering at Spotify
Collaborative Filtering at SpotifyCollaborative Filtering at Spotify
Collaborative Filtering at Spotify
 
Ten Cities, Four Countries, Five Years: Lessons on the Process of Building Ur...
Ten Cities, Four Countries, Five Years: Lessons on the Process of Building Ur...Ten Cities, Four Countries, Five Years: Lessons on the Process of Building Ur...
Ten Cities, Four Countries, Five Years: Lessons on the Process of Building Ur...
 
Where is the conversation?
Where is the conversation?Where is the conversation?
Where is the conversation?
 
Clojure + MongoDB on Heroku
Clojure + MongoDB on HerokuClojure + MongoDB on Heroku
Clojure + MongoDB on Heroku
 
Metagame Design
Metagame DesignMetagame Design
Metagame Design
 
『はじめてのClojure』勉強会#3 第7章:テスト、テスト、テスト
『はじめてのClojure』勉強会#3 第7章:テスト、テスト、テスト『はじめてのClojure』勉強会#3 第7章:テスト、テスト、テスト
『はじめてのClojure』勉強会#3 第7章:テスト、テスト、テスト
 
How to Use Video to Crush Your B2B Marketing Goals
How to Use Video to Crush Your B2B Marketing GoalsHow to Use Video to Crush Your B2B Marketing Goals
How to Use Video to Crush Your B2B Marketing Goals
 
Clojure入門
Clojure入門Clojure入門
Clojure入門
 
IdeaMart: Case Study in Service Innovation Success, Shafraz Rahim, Dialog Axiata
IdeaMart: Case Study in Service Innovation Success, Shafraz Rahim, Dialog AxiataIdeaMart: Case Study in Service Innovation Success, Shafraz Rahim, Dialog Axiata
IdeaMart: Case Study in Service Innovation Success, Shafraz Rahim, Dialog Axiata
 
ClojureでElectronアプリを作ろう
ClojureでElectronアプリを作ろうClojureでElectronアプリを作ろう
ClojureでElectronアプリを作ろう
 
6 tendances de la formation professionnelle : quand le digital change la donne
6 tendances de la formation professionnelle : quand le digital change la donne6 tendances de la formation professionnelle : quand le digital change la donne
6 tendances de la formation professionnelle : quand le digital change la donne
 

Plus de sohta

Clojureシンタックスハイライター開発から考えるこれからのlispに必要なもの
Clojureシンタックスハイライター開発から考えるこれからのlispに必要なものClojureシンタックスハイライター開発から考えるこれからのlispに必要なもの
Clojureシンタックスハイライター開発から考えるこれからのlispに必要なものsohta
 
入門Transducers
入門Transducers入門Transducers
入門Transducerssohta
 
入門core.async
入門core.async入門core.async
入門core.asyncsohta
 
REPLライフをもっと快適に
REPLライフをもっと快適にREPLライフをもっと快適に
REPLライフをもっと快適にsohta
 
genuine-highlighter: マクロを認識するClojure向けのシンタックスハイライター
genuine-highlighter: マクロを認識するClojure向けのシンタックスハイライターgenuine-highlighter: マクロを認識するClojure向けのシンタックスハイライター
genuine-highlighter: マクロを認識するClojure向けのシンタックスハイライターsohta
 
ClojureではじめるSTM入門
ClojureではじめるSTM入門ClojureではじめるSTM入門
ClojureではじめるSTM入門sohta
 
Macros in Clojure
Macros in ClojureMacros in Clojure
Macros in Clojuresohta
 
Clojureによるバイトコードプログラミング
ClojureによるバイトコードプログラミングClojureによるバイトコードプログラミング
Clojureによるバイトコードプログラミングsohta
 

Plus de sohta (8)

Clojureシンタックスハイライター開発から考えるこれからのlispに必要なもの
Clojureシンタックスハイライター開発から考えるこれからのlispに必要なものClojureシンタックスハイライター開発から考えるこれからのlispに必要なもの
Clojureシンタックスハイライター開発から考えるこれからのlispに必要なもの
 
入門Transducers
入門Transducers入門Transducers
入門Transducers
 
入門core.async
入門core.async入門core.async
入門core.async
 
REPLライフをもっと快適に
REPLライフをもっと快適にREPLライフをもっと快適に
REPLライフをもっと快適に
 
genuine-highlighter: マクロを認識するClojure向けのシンタックスハイライター
genuine-highlighter: マクロを認識するClojure向けのシンタックスハイライターgenuine-highlighter: マクロを認識するClojure向けのシンタックスハイライター
genuine-highlighter: マクロを認識するClojure向けのシンタックスハイライター
 
ClojureではじめるSTM入門
ClojureではじめるSTM入門ClojureではじめるSTM入門
ClojureではじめるSTM入門
 
Macros in Clojure
Macros in ClojureMacros in Clojure
Macros in Clojure
 
Clojureによるバイトコードプログラミング
ClojureによるバイトコードプログラミングClojureによるバイトコードプログラミング
Clojureによるバイトコードプログラミング
 

Clojure Language Update (2015)